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=ans2d0pdoPwaPOKkKlaK+U7eA3iAi r+7fgOnL20sllpoADNZgU3FzlEdRGsMKc3uSQO3j0/9JXR7lsnAhm7XY90zn0Efs mgltWHPc9HiEFF/SJRHzIZq+Lgma+03mwmt/AQaeAMVcwaAAboKF8Qo9cL0r0MNm y6yk1Z5OAghkLA= 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=uee0l2gE1hKP5SELbD50QcnZKUY=; b=bH5 HvR8TQKmXE9XYflT+C8Yjxc/t0MuJjmli+KcCFuSsjOEQ3iw4vtDzwJaAfQJkiAo z4qIEtAnB1UcLTDgijhaBdF7lu2vnQIAwNF5r8HEjijIQfwH6K7HTJQYPqK8JCvm zMTleREEFN1PGXj6jKLoefS2CddAjGW2gSLPlOLU= 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=installing, H*M:2b5e X-HELO: NAM02-SN1-obe.outbound.protection.outlook.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=niYLZ6oHgn3o+ncW49YTd7+y6c3yT8aJOfuFPJiLOynluVxD0ret6wtCdW4bG1CffPkQMbxuLGXfzTb0PPtDByDEr6Oj7b3jEuXJ11Bqfz35w2WZBNctmNkepoCVEtO0QWJrFdNcZbDmrMwuPlI9I5pi04+7Ez3EBD+GWaXzSYLkOfc/uYHBqoIu6bb0VHn5ynI8p6/5df1F/qGfby6ocacoDAVq0VIgf74Jg/pz3Oj/cziZqGvafYi1kJO1G9/Sj1Eo54O2wgji0gnVUiMFWgIuz80RYs85vxtv/SMDTCVd0ccTdFJhY7QR+zLhHqxJqULhME6qHDskzjSjbjbRYw== 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=VNg2WZyRHVdN8QFPZbXUxVp5Q9L78+wc5yv/tfRL3TM=; b=iyjj69kwrlvg0EVKkzDM2bq6vgHi9/igU4O+Htb037MwAtucyAbCqiGx4XJ4tL8EWIEQJTweVA6T5289JPcJq5b4tNJCWkDaGbuhyBbqtFbS3riCJgOGW1prqsJbxO1WLatwYwpSqfhFiU3HpIuUIDXqp6IPzKlEd3f5TfudiJ3gBlB3s0pBds/P/Hc5e4HJ/inxjAfM7penxKLvlWOgesaihJS+2QW0Jr3oR2qsTRXXJVGJYu3wpsW8BNGQJgKTTTMK6WqmF5rtt8lUvnW9/UN4smTj/o8yY9RNb9jg5BHmOTH1Tk0GckK+t7AWb45dvwF/2L1HYgL1tb+TF8sr9w== 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=VNg2WZyRHVdN8QFPZbXUxVp5Q9L78+wc5yv/tfRL3TM=; b=j3nZV/pyrqR/dI9GheaKZV2Mg8HYO9U7Z4cmb3n4ir4hIhb/mJuD2dXD6SxxG8m9421YEcW9oG85J5SoSK7nx+XQYyhvXgjYLO/AzJc0+gQehnTQ+feT9bz2ueNsLv+5fQfTZv//1yCi9gG/HmOUgkfxHcEoFZKhw81+8QzztKc= 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 14:53:41 +0000 Message-ID: <20754eea-2b5e-dbbb-6027-2643be062e41@cornell.edu> References: In-Reply-To: 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-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: <403D641AB5185D4C8ABF13C74B95B010 AT namprd04 DOT prod DOT outlook DOT com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: hAevUnaeMu1ichOQbLG5wfwGcMAPefaUp1zpiQxs2tsSbLWzZYn5q/5KOVYf5uVLQaFlbSuOfkrAYKTOIXHemw== X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id x9TEsGBY002265 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 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