Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use exact IPv4/IPv6 address in test_run:cmd() #197

Merged
merged 1 commit into from Dec 31, 2019

Commits on Dec 25, 2019

  1. Use exact IPv4/IPv6 address in test_run:cmd()

    When test-run's inspector listens on a IPv4 port and some other process
    listens on a IPv6 port of the same number, test_run:cmd() could connect
    to this process rather then the inspector, because 'localhost' hostname
    was used to connect.
    
    Now test-run passes actual IP address of the inspector via an
    environment variable and test_run:cmd() uses it to avoid the ambiguity
    that is described above.
    
    The problem was found during many parallel runs of app/socket.test.lua
    test from tarantool, see case 4 in [1] (untitled, see right under case
    3). This test starts many TCP servers and in rare cases a server port
    may be the same as inspector's one.
    
    There are two details that increase probability of the problem:
    
    * It seems test-run's inspector always listens on IPv4 address, because
      it is configured with 'localhost' hostname and
      gevent.server.StreamServer implementation always chooses IPv4 for
      'localhost' (see [2], _parse_address() function).
    
    * socket.tcp_connect() typically tries to connect to an IPv6 address
      first and only then to an IPv4 one, because getaddrinfo() returns
      addresses in this order according to RFC 3484 (see [3], section 2.1
      'Policy table'). This however can be configured in /etc/gai.conf.
    
    [1]: https://lists.tarantool.org/pipermail/tarantool-patches/2019-December/013321.html
    [2]: https://github.com/gevent/gevent/blob/ba3b15de7eb568fa09fdf1a9d28241288163ba67/src/gevent/baseserver.py#L406-L409
    [3]: https://tools.ietf.org/rfc/rfc3484.txt
    Totktonada committed Dec 25, 2019
    Copy the full SHA
    fee2e29 View commit details
    Browse the repository at this point in the history