From a5543025651e02c94713ccbdc1a189b0e49efc90 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Fri, 21 Jun 2024 21:45:27 +0900 Subject: [PATCH] retry on cancelling of `getaddrinfo` When the registerred unblock function is called, it should retry the cancelled blocking function if possible after checkints. For example, `SIGCHLD` can cancel this method, but it should not raise any exception if there is no trap handlers. The following is repro-code: ```ruby require 'socket' PN = 10_000 1000000.times{ p _1 PN.times{ fork{ sleep rand(0.3) } } i = 0 while iai; } else if (arg->cancelled) { - err = EAI_AGAIN; + retry = 1; } else { // If already interrupted, rb_thread_call_without_gvl2 may return without calling wait_getaddrinfo. @@ -731,7 +731,7 @@ rb_getnameinfo(const struct sockaddr *sa, socklen_t salen, } } else if (arg->cancelled) { - err = EAI_AGAIN; + retry = 1; } else { // If already interrupted, rb_thread_call_without_gvl2 may return without calling wait_getnameinfo.