ruby-changes:63959
From: Masaki <ko1@a...>
Date: Sun, 6 Dec 2020 01:05:15 +0900 (JST)
Subject: [ruby-changes:63959] c56a1c1953 (master): Extend sleep time to 1.5 second in rb_getaddrinfo_a_before_exec()
https://git.ruby-lang.org/ruby.git/commit/?id=c56a1c1953 From c56a1c1953bf25581a6a0cd4ade22d2691a920e0 Mon Sep 17 00:00:00 2001 From: Masaki Matsushita <glass.saga@g...> Date: Sat, 5 Dec 2020 18:05:09 +0900 Subject: Extend sleep time to 1.5 second in rb_getaddrinfo_a_before_exec() After 94d49ed31c, TestSocket#test_getaddrinfo_after_fork fails in some platforms. To avoid this, the change extends sleep time to 1.5 second. diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c index 07659a7..249ce03 100644 --- a/ext/socket/raddrinfo.c +++ b/ext/socket/raddrinfo.c @@ -436,6 +436,8 @@ gaicbs_wait_all(void) https://github.com/ruby/ruby/blob/trunk/ext/socket/raddrinfo.c#L436 gai_suspend(reqs, size, NULL); // ignore result intentionally } +#define MILLISECOND_IN_NANOSECONDS 1000000 + /* A mitigation for [Bug #17220]. It cancels all outstanding requests and waits for ongoing requests. Then, it waits internal worker threads in getaddrinfo_a(3) to be finished. */ @@ -447,7 +449,8 @@ rb_getaddrinfo_a_before_exec(void) https://github.com/ruby/ruby/blob/trunk/ext/socket/raddrinfo.c#L449 /* wait worker threads in getaddrinfo_a(3) to be finished. they will finish after 1 second sleep. */ - sleep(1); + struct timespec ts = {1, 500 * MILLISECOND_IN_NANOSECONDS}; + nanosleep(&ts, NULL); } int -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/