diff options
author | Misaki Shioi <[email protected]> | 2024-11-29 18:49:02 +0900 |
---|---|---|
committer | <[email protected]> | 2024-11-29 18:49:02 +0900 |
commit | 49d2e79fb0dd57caed269c67660ff4cc68b3d729 () | |
tree | 5624faad5d548283996a1d7eb530cde2e1495247 /ext/socket/raddrinfo.c | |
parent | 22e1a8c478e92fafcb597d74a2d4f08c57f07c4c (diff) |
Ensure to close pipes when `TCPSocket.new` finishes processing (#12181)
`TCPSocket.new` with HEv2 uses three threads. The last of these threads to exit closed pipes. However, if pipes were open at the end of the main thread, they would . This change avoids this by closing pipes at the end of the main thread.
Notes: Merged-By: shioimm <[email protected]>
-rw-r--r-- | ext/socket/raddrinfo.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -3033,8 +3033,6 @@ free_fast_fallback_getaddrinfo_shared(struct fast_fallback_getaddrinfo_shared ** (*shared)->node = NULL; free((*shared)->service); (*shared)->service = NULL; - close((*shared)->notify); - close((*shared)->wait); rb_nativethread_lock_destroy((*shared)->lock); free(*shared); *shared = NULL; @@ -3057,6 +3055,11 @@ do_fast_fallback_getaddrinfo(void *ptr) struct fast_fallback_getaddrinfo_shared *shared = entry->shared; int err = 0, need_free = 0, shared_need_free = 0; err = numeric_getaddrinfo(shared->node, shared->service, &entry->hints, &entry->ai); if (err != 0) { @@ -3101,7 +3104,7 @@ do_fast_fallback_getaddrinfo(void *ptr) const char notification = entry->family == AF_INET6 ? IPV6_HOSTNAME_RESOLVED : IPV4_HOSTNAME_RESOLVED; - if ((write(shared->notify, ¬ification, 1)) < 0) { entry->err = errno; entry->has_syserr = true; } |