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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=hcD62tXM4uql4RcOxy4kyCjGsS/POhIoP9CVEopZwP1f6Cw922atK Zj0nAOT0J9PomZyRE/LKdvI3il78piT34rkj1NvbYbLBFZ0gSVHSCz2BeWQ6Wmwe b9GuqCvU/Yqnsdjen47q/sEc6tamRG+f8ofT5C17pXYmCddUllfw4A= 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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=G4N0LBjslwW7t5vJ6QiGwOLNQYo=; b=ExXRb1AJegjzJ3H9Ne4HyFChBjH/ 3MF5wl9s/4eFUaelSr72NcokktTxM7IOWdlR7T48mPi37wRsJpnDw5yxjMcxqYLc SLqQM0RkuOJm6UHhJJaphnyEAEMwvSF5PJdDuKQWBUtPl3mffJsynB1dlFfGOye1 BrzCCzdvj3DfCNk= 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=-101.7 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1616, died X-HELO: drew.franken.de Date: Fri, 10 Mar 2017 21:10:36 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: fork() fails if it is called recursively from a child thread. Message-ID: <20170310201036.GA18927@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20170309203959 DOT 1e7e32d20bf7ec06c705d3ba AT nifty DOT ne DOT jp> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="YiEDa0DAkWCtVeE4" Content-Disposition: inline In-Reply-To: <20170309203959.1e7e32d20bf7ec06c705d3ba@nifty.ne.jp> User-Agent: Mutt/1.7.1 (2016-10-04) --YiEDa0DAkWCtVeE4 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Mar 9 20:39, Takashi Yano wrote: > Hello, >=20 > I found fork() fails if it is called recursively from a child thread. >=20 > Simple test case, attached (fk.c), reproduces this problem. >=20 > 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. >=20 > 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 unexpecte= dly, retry 0, exit code 0xC0000142, errno 11 > fork(): Resource temporarily unavailable >=20 > 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(). >=20 > 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 --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --YiEDa0DAkWCtVeE4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYwwg7AAoJEPU2Bp2uRE+gaq4P/2eCe4+BUhC8aTBtXUDTBmtl 4cHlLZPI97Zpiacq8TQ6ZaEvNW6NYtM49t1P6e1qm5bKeXkALeORVkCvCiPsZ1Cn RhyGGrTJL6X9abNFhNrJmKl9PMEbcTDsXQ9DoW1TpWHXiFhnNHy+8v3hE3XpAnXp lZUvm/SKlRZgAZPwZ0U/umJiuN1yUBKMqen8WbN67PXQWVTdNTPB10doe7tuYrjD OpEij52TuO97LLD2EKKfNoM+mSWj/R28QICqgJAucnW1afawjVga2NndrfFOY5YX xIEDbhPkdCe8PWco5mbJXGqr/QKr6TJTQ5tYompSWULEM4CtJhC4CT6g0i3XAnYX Swfu/sXgKMPCdLweRwPojFvBKB0xbDe5QKlC3lsHHg6RzQ3xtIZ7DwPYM9poh+RR 7vvhhYownjeIHtFOnfxR5yCC6Ozj9q6Ut/8vjMizvj7nzNyzk/7HJgYuHAMaTuH9 EiGz6Bs0Z+/rG8EqsYqpm1Qz+boGh4i60Z1z4vtxNCZPMjYPrLEwdGnqq4U5eBHT gofAIhTKATmMsUU1FQv5EIUkDY0Cu634frI2d6Ooc4Oq4Vc96AGjhUjXy5ZGLG3b lHWGRzX9rfvsXAWJOhBtFZF4FHlUA6u9XV9qkzLQNDcgU39NCKUKh0Mcp3jreh/T qYG8zyKphuQqBsflVmKZ =JMlZ -----END PGP SIGNATURE----- --YiEDa0DAkWCtVeE4--