diff options
author | Masaki Matsushita <glass.saga@gmail.com> | 2020-12-05 18:05:09 +0900 |
---|---|---|
committer | Masaki Matsushita <glass.saga@gmail.com> | 2020-12-06 01:01:13 +0900 |
commit | c56a1c1953bf25581a6a0cd4ade22d2691a920e0 (patch) | |
tree | 41fad7c0a6e6e3ccb17fd65201fd101ece5cacd6 /ext/socket | |
parent | 9dbb2bfd73e66106ec75fb9fff3ac38d85e40395 (diff) |
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.
Diffstat (limited to 'ext/socket')
-rw-r--r-- | ext/socket/raddrinfo.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c index 07659a760d..249ce035fd 100644 --- a/ext/socket/raddrinfo.c +++ b/ext/socket/raddrinfo.c @@ -436,6 +436,8 @@ gaicbs_wait_all(void) 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) /* 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 |