From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A50F439450CD; Tue, 20 Oct 2020 13:31:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A50F439450CD From: "nobu@ruby-lang.org" To: glibc-bugs@sourceware.org Subject: [Bug nss/26760] New: getaddrinfo_a blocks in a forked process after it was finished in the parent process Date: Tue, 20 Oct 2020 13:31:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: nss X-Bugzilla-Version: 2.31 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nobu@ruby-lang.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Oct 2020 13:31:47 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26760 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 afte= r it finished in the parent process. // gaitest.c #define _GNU_SOURCE #include #include #include #include #include #include int test_gai(const char *where, const char *name) { printf("in %s: ", where); fflush(stdout); struct gaicb req =3D {.ar_name =3D name}; struct gaicb *reqs[1] =3D {&req}; int ret =3D getaddrinfo_a(GAI_NOWAIT, reqs, 1, NULL); if (ret) goto error; ret =3D gai_suspend((const struct gaicb **)reqs, 1, NULL); if (ret) goto error; ret =3D gai_error(reqs[0]); if (ret) goto error; struct addrinfo *ai =3D 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 =3D fork(); if (pid =3D=3D 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 --=20 You are receiving this mail because: You are on the CC list for the bug.=