public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nss/26760] New: getaddrinfo_a blocks in a forked process after it was finished in the parent process
@ 2020-10-20 13:31 nobu@ruby-lang.org
2020-10-20 14:32 ` [Bug nss/26760] " schwab@linux-m68k.org
2020-10-21 4:15 ` yasuo.honda at gmail dot com
0 siblings, 2 replies; 3+ messages in thread
From: nobu@ruby-lang.org @ 2020-10-20 13:31 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=26760
Bug ID: 26760
Summary: getaddrinfo_a blocks in a forked process after it was
finished in the parent process
Product: glibc
Version: 2.31
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: nss
Assignee: unassigned at sourceware dot org
Reporter: nobu@ruby-lang.org
Target Milestone: ---
getaddrinfo_a hangs up when called in a process forked within 1 second after it
finished in the parent process.
// gaitest.c
#define _GNU_SOURCE
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
int
test_gai(const char *where, const char *name)
{
printf("in %s: ", where);
fflush(stdout);
struct gaicb req = {.ar_name = name};
struct gaicb *reqs[1] = {&req};
int ret = getaddrinfo_a(GAI_NOWAIT, reqs, 1, NULL);
if (ret) goto error;
ret = gai_suspend((const struct gaicb **)reqs, 1, NULL);
if (ret) goto error;
ret = gai_error(reqs[0]);
if (ret) goto error;
struct addrinfo *ai = reqs[0]->ar_result;
if (ai) {
printf("%s\n", ai->ai_canonname ? ai->ai_canonname : "noname");
}
return 0;
error:
fprintf(stderr, "failed: %s\n", gai_strerror(ret));
return ret;
}
int
main(int argc, char **argv)
{
test_gai("parent", "localhost");
if (argc > 1) {
printf("sleeping...");
fflush(stdout);
usleep((useconds_t)(atof(argv[1])*1e6));
printf("\n");
}
pid_t pid = fork();
if (pid == 0) {
test_gai("child", "localhost");
return 0;
}
int status;
waitpid(pid, &status, 0);
return status;
}
// end of gaitest.c
$ gcc -o gaitest gaitest.c -lanl
$ ./gaitest 1
in parent: noname
sleeping...
in child: noname
$ ./gaitest 0.9
in parent: noname
sleeping...
in child: ^C
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug nss/26760] getaddrinfo_a blocks in a forked process after it was finished in the parent process
2020-10-20 13:31 [Bug nss/26760] New: getaddrinfo_a blocks in a forked process after it was finished in the parent process nobu@ruby-lang.org
@ 2020-10-20 14:32 ` schwab@linux-m68k.org
2020-10-21 4:15 ` yasuo.honda at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: schwab@linux-m68k.org @ 2020-10-20 14:32 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=26760
--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
I don't think getaddrinfo_a is intented to be async-signal-safe.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug nss/26760] getaddrinfo_a blocks in a forked process after it was finished in the parent process
2020-10-20 13:31 [Bug nss/26760] New: getaddrinfo_a blocks in a forked process after it was finished in the parent process nobu@ruby-lang.org
2020-10-20 14:32 ` [Bug nss/26760] " schwab@linux-m68k.org
@ 2020-10-21 4:15 ` yasuo.honda at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: yasuo.honda at gmail dot com @ 2020-10-21 4:15 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=26760
Yasuo Honda <yasuo.honda at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yasuo.honda at gmail dot com
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-21 4:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-20 13:31 [Bug nss/26760] New: getaddrinfo_a blocks in a forked process after it was finished in the parent process nobu@ruby-lang.org
2020-10-20 14:32 ` [Bug nss/26760] " schwab@linux-m68k.org
2020-10-21 4:15 ` yasuo.honda at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).