Skip to content
  • Kasumi Hanazuki's avatar
    3231ac60
    [ruby/resolv] test_dns: Fix FD leak · 3231ac60
    Kasumi Hanazuki authored
    The listening TCP socket is closed by `with_udp_and_tcp` helper, but
    the connected socket is leaking.
    
    ```
    Leaked file descriptor: TestResolvDNS#test_multiple_servers_with_timeout_and_truncated_tcp_fallback: 12 : #<TCPSocket:fd 12, AF_INET, 127.0.0.1, 50888>
    COMMAND     PID     USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
    ruby    3248055 chkbuild   12u  IPv4 112546322      0t0  TCP localhost:50888->localhost:40112 (CLOSE_WAIT)
    ```
    
    For the purpose of the test case to simulate a timeout over TCP
    transport, we have to delay closing this socket until the end the test
    case.
    
    Fixup: https://github.com/ruby/resolv/pull/50
    
    https://github.com/ruby/resolv/commit/236c38bdb1
    3231ac60
    [ruby/resolv] test_dns: Fix FD leak
    Kasumi Hanazuki authored
    The listening TCP socket is closed by `with_udp_and_tcp` helper, but
    the connected socket is leaking.
    
    ```
    Leaked file descriptor: TestResolvDNS#test_multiple_servers_with_timeout_and_truncated_tcp_fallback: 12 : #<TCPSocket:fd 12, AF_INET, 127.0.0.1, 50888>
    COMMAND     PID     USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
    ruby    3248055 chkbuild   12u  IPv4 112546322      0t0  TCP localhost:50888->localhost:40112 (CLOSE_WAIT)
    ```
    
    For the purpose of the test case to simulate a timeout over TCP
    transport, we have to delay closing this socket until the end the test
    case.
    
    Fixup: https://github.com/ruby/resolv/pull/50
    
    https://github.com/ruby/resolv/commit/236c38bdb1
Loading