X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:references:to:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=RqdLJtLkfSxY01on vQcA4P0yEQFnYuW87+/zZeRZvvusumP4n2syDNb2duKCywhLAZV9dro/7c0F+F7z 0yamaLinBrhCLcXP7vqSyJ7Ui2B6/oK8ckqnE1FWLjsuOFqCAfEs9epIcntKHVNx ILXL5GqpmDWtVQwI+3ai0O01bOg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:references:to:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=sZjz/BfVC5xHE984eqGppq wn58o=; b=ZUc/s6tg0lldWUk+4W6kF06QZoBhJSq/QWrCSseD/AkzyVdxCm/jee ynUUGj+w+jVpO0AJToWWC+t6rtHZB54+u6Q5JhuiitUKzHTboO6+bDq0j3K62nEB 1CId5+AH9+XFLMo+APhRUuoRgHqUWx3MgbRL35McD16clqCd+WUzA= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=died X-HELO: mailsrv.cs.umass.edu Reply-To: moss AT cs DOT umass DOT edu Subject: Re: fork() fails if it is called recursively from a child thread. References: <20170309203959 DOT 1e7e32d20bf7ec06c705d3ba AT nifty DOT ne DOT jp> To: cygwin AT cygwin DOT com From: Eliot Moss Message-ID: <882e88d5-d508-fee8-e22c-47434297e8c8@cs.umass.edu> Date: Thu, 9 Mar 2017 08:53:19 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170309203959.1e7e32d20bf7ec06c705d3ba@nifty.ne.jp> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes On 3/9/2017 6:39 AM, 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. > > Is this the known issue? This strikes me as either BLODA (interfering software) or a need to rebase some dll(s). That's what I most commonly see that causes that fork error. Regards - Eliot Moss -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple