From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: fork() fails if it is called recursively from a child thread.
Date: Fri, 10 Mar 2017 20:10:00 -0000 [thread overview]
Message-ID: <20170310201036.GA18927@calimero.vinschen.de> (raw)
In-Reply-To: <20170309203959.1e7e32d20bf7ec06c705d3ba@nifty.ne.jp>
[-- Attachment #1: Type: text/plain, Size: 1654 bytes --]
Hi,
On Mar 9 20:39, Takashi Yano wrote:
> Hello,
>
> I found fork() fails if it is called recursively from a child thread.
>
> Simple test case, attached (fk.c), reproduces this problem.
>
> Expected result:
> Parent 0 [22034] exit.
> Child 0 [22036] works.
> Parent 1 [22036] exit.
> Child 1 [22038] works.
> Parent 2 [22038] exit.
> Child 2 [22039] works.
> Parent 3 [22039] exit.
> Child 3 [22040] works.
> Parent 4 [22040] exit.
> Child 4 [22041] works.
>
> Result in cygwin 2.7.0:
> Child 0 [4668] works.
> Parent 0 [7188] exit.
> 0 [main] a 4668 fork: child -1 - forked process 8456 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
> fork(): Resource temporarily unavailable
>
> Strictly speaking, the test case is not safe because it calls functions
> which are not async-signal-safe from forked child process, i.e. printf()
> and perror(), in spite of multi-thread. However the same happens even
> without printf() and perror().
>
> This is the cause of which iperf 2.0.5 with option -s -D fails to start
> as daemon.
Thanks for the report and especially the testcase.
It was a tricky problem to debug so it took me a while, but I think
I got it now.
I uploaded new developer snapshots to https://cygwin.com/snapshots/
Please give them a try. I'd be also interested if that fixes the iperf
problem. Can you check? There's always a chance that this uncovers
another problem hidden under this one...
Thanks,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2017-03-10 20:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-09 11:40 Takashi Yano
2017-03-09 13:53 ` Eliot Moss
2017-03-09 16:16 ` Takashi Yano
2017-03-09 17:06 ` Achim Gratz
2017-03-09 17:33 ` Takashi Yano
2017-03-09 19:48 ` cyg Simple
2017-03-10 20:10 ` Corinna Vinschen [this message]
2017-03-11 1:29 ` Takashi Yano
2017-03-21 15:05 ` Erik Bray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170310201036.GA18927@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).