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:from:to:subject:date:message-id:references :in-reply-to:content-type:content-id:content-transfer-encoding :mime-version; q=dns; s=default; b=JDGX5nifBE3DiaP99ZY+y/xzGJr+N FhQkVcwfMZ9bhdDBeASKjfz4Pai6nNdA3oi85YjsHOySzVo/BdjqhUg7N/OhUf/5 7Ev18sVEpbmpFJGb1c87mQZg+KiB2ZOojkMvhQKfA72MF9x0Uk+MTFHxjpMDHCkI joQox/7qqEZC3E= 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:from:to:subject:date:message-id:references :in-reply-to:content-type:content-id:content-transfer-encoding :mime-version; s=default; bh=aixwoElp0fBOl/HnpC5FJIhjPJA=; b=f7r dHF/z4Kq4BvwXX1RiDGAdwqyIHv9udiVLN8r8jtIwGIbpa1GwgGRJS6bsdTz5VyA WC0DhCRdpTnDoYL8CqNYGjLfij/EzJHiezXpcZ0Pokt2f1U7WlfjAVIH7GBXzaMy JvZxzrge3rful97KV5ZNYfPN64HHwrKMaGP9wb9w= 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-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: NAM02-SN1-obe.outbound.protection.outlook.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GlVOp9RaxN1m74j+mO4nlQk5OW/nzDQOInlx3Xuhno+9f0ptEDIVms2RGPeERLKcNm05mHFHte4W+CQZItoDMUi6vaH5OYMeInYDhfeilETeRj0pPCVyvCJoNnt/fbfld8VpoScL6llMsm/ahft1iSYVVV29bmw8OaOFXSUqsr2G9WrUR5a46x155v5v6urzVv5l2r4WRcwGOyWfVigATrgHRu0T1CF3OAMuRqeFT44Pbvdvy+Gbw0FvOwpbL4egGPUSJ48MKUHfBovQQziezSqEhRAz0FAinXkszYFgRQ4VwJu6DqcJTQRGKzMxAZzgSdGw+ht0lYHK9TdW94iVEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fV8wsJe82w4Ak8xZS2I9N21bjFtJtcAL2d/n64jbXb4=; b=dPU9vO+aM1Cgan+1C8L293Hs97X0HJ/LgjLl4Wz198Iz2+5yEzzoPneQRssXESYbKrtfnyr3trzZuiVAEBNwN1MffBmdoJ7sQxPRmgz4gbGnzabsRaiNRDompP61xIGoY3NYJzNWEkko/Qg1zCXfNluE2epxVNo1achvsV0x7oD6K+8zMOmqyLwIas6ag3N/w4BrQxzu9wz/aFaMmP/tXg8g7D/s0y5gYg8+WCWjQBv8cN9a7bGH6TdRDoLk2TrZ5t3d96GgXQxKApQDZIRRPdu4mPw1bIaxmuIc1UD+W5Zx6kXpHzmM7qf6d3NoEwXaYXKV7dO1Yv724II4suaLDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cornell.edu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fV8wsJe82w4Ak8xZS2I9N21bjFtJtcAL2d/n64jbXb4=; b=XzgD/smnJlVrUJAxgK/GDXNdWcE6ilFb1etxfbC3M8rZRvAeeGR7OaMbR/2yJ5TVguMD6JH7XqTjIuf46kxD32ZSkhtzrqRPPDBcrko5FSDcDxBUvjFfv9lZp13KC58mebAuXNJ6MNyEnjgbEAN+313r35eeSMSzz9BGl6/t/5w= From: Ken Brown To: "cygwin AT cygwin DOT com" Subject: Re: program exit code, "at exit" handler and explicit close of shared objects Date: Tue, 29 Oct 2019 15:30:57 +0000 Message-ID: <1805e95e-6733-7a73-56fe-8493389ae367@cornell.edu> References: <20754eea-2b5e-dbbb-6027-2643be062e41 AT cornell DOT edu> In-Reply-To: <20754eea-2b5e-dbbb-6027-2643be062e41@cornell.edu> user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=kbrown AT cornell DOT edu; x-ms-exchange-purlcount: 4 x-ms-oob-tlc-oobclassifiers: OLM:5236; received-spf: None (protection.outlook.com: cornell.edu does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="Windows-1252" Content-ID: <5E4CBEBA51B807429F2E7CA3DAFB5432 AT namprd04 DOT prod DOT outlook DOT com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: v8Z84lOlmR0Dcqw6mLLZNa1jljfcDGWV/NH01fl1qZ+HB+EdXL9a30EilKYE9uEJDqOCmLVUEF5J2kp/fIoLKg== X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id x9TFViD5006557 On 10/29/2019 10:53 AM, Ken Brown wrote: > On 10/26/2019 11:07 AM, Roumen Petrov wrote: >> >> After additional tests (research) I was able to isolate issues to simple test >> case. Please find attached "test-dlclose.c" and "Makefile". >> First test is as is: >> >> $ make >> cc -g -Wall -Wextra    test-dlclose.c   -o test-dlclose >> ./test-dlclose >> exit with code 33 >> make: [Makefile:4: all] Error 33 (ignored) >> >> For next test change test-dlclose.c to define DLCLOSE_ATEXIT ( s/#if 0/#if 1/ ): >> $ make >> cc -g -Wall -Wextra    test-dlclose.c   -o test-dlclose >> ./test-dlclose >> exit with code 33 > > I ran this second version of test-dlclose (with DLCLOSE_ATEXIT defined) under > strace and got the following: > > $ strace -o trace.out ./test-dlclose.exe > exit with code 33 > Segmentation fault > > The strace output ends with > > 30 30143 [main] test-dlclose 847 write: 18 = write(1, 0x600061E20, 18) > --- Process 33456 (pid: 847) unloaded DLL at 00000003e7930000 > --- Process 33456 (pid: 847), exception c0000005 at 00000003e7931080 > --- Process 33456 (pid: 847) thread 26088 exited with status 0xc0000005 > --- Process 33456 (pid: 847) thread 33544 exited with status 0xc0000005 > --- Process 33456 (pid: 847) thread 36020 exited with status 0xc0000005 > --- Process 33456 exited with status 0xc0000005 > > The address 00000003e7930000 seems to be in /usr/bin/cygz.dll, which is the DLL Sorry, I meant to say 00000003e7931080; 00000003e7930000 is the start of cygz.dll. > that got unloaded. After installing zlib-debuginfo, I ran addr2line to see > where the crash occurred, and this too crashed: > > $ addr2line -C -f -i -p -e /usr/bin/cygz.dll 0x3e7931080 > Segmentation fault (core dumped) > > That's as far as I've gotten. > > Ken > > -- > 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 > -- 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