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

test_dns: Fix FD leak #60

Merged
merged 1 commit into from
Sep 10, 2024
Merged

test_dns: Fix FD leak #60

merged 1 commit into from
Sep 10, 2024

Conversation

hanazuki
Copy link
Contributor

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)

Fixup: #50

@hanazuki
Copy link
Contributor Author

Could you take a look? @hsbt

@hanazuki hanazuki marked this pull request as draft September 1, 2024 06:12
@hanazuki
Copy link
Contributor Author

hanazuki commented Sep 1, 2024

I see some CI failures in my forked repo, which seem related to this change. I realized that this patch is not good as it alters the meaning of the test case (the TCP requester now experiences early shutdown instead of timeout). I'll revise the patch.

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: ruby#50
@hanazuki hanazuki marked this pull request as ready for review September 1, 2024 08:54
@hanazuki
Copy link
Contributor Author

hanazuki commented Sep 1, 2024

I have updated the patch.

@nobu nobu merged commit 366654e into ruby:master Sep 10, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants