From owner-freebsd-amd64@freebsd.org Fri Jan 6 12:58:12 2017 Return-Path: Delivered-To: freebsd-amd64@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FF10CA240F for ; Fri, 6 Jan 2017 12:58:12 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7635C1B35 for ; Fri, 6 Jan 2017 12:58:12 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v06CwCY5099589 for ; Fri, 6 Jan 2017 12:58:12 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-amd64@FreeBSD.org Subject: [Bug 215826] C++ program signal handlers not called Date: Fri, 06 Jan 2017 12:58:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: misc X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kami@freebsd.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter cc Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2017 12:58:12 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D215826 Bug ID: 215826 Summary: C++ program signal handlers not called Product: Base System Version: CURRENT Hardware: amd64 OS: Any Status: New Severity: Affects Some People Priority: --- Component: misc Assignee: freebsd-bugs@FreeBSD.org Reporter: kami@freebsd.org CC: freebsd-amd64@FreeBSD.org CC: freebsd-amd64@FreeBSD.org 18 days ago I got a bug report for sysutils/powerdxx: https://github.com/lonkamikaze/powerdxx/issues/3 There is some distracting content in the report, e.g. the OP misidentified = an unrelated ACPI problem as part of the problem he/she was reporting. The issue to sum it up is, that (at least my) C++ programs don't get their signal handlers called (that includes default signal handlers that I never touched). Affected are the `loadrec` and `powerd++` binaries. The `loadrec` binary do= es not touch signal handlers, so the default handlers stay in place. I had a couple of people try to help me debug the issue and as far as we co= uld tell using truss and dtrace signals got sent, but the signal handlers just don't get called. I don't know how to debug this further (how do you debug something that is not happening?). But we found a workaround: link with `-lpthread`. My assumption is that `pthread` replaces system functions with thread safe versions and as a side effect replaces whatever got recently br= oken on CURRENT. I documented this workaround in the Makefile of my project: https://github.com/lonkamikaze/powerdxx/commit/2d80d990121802b4402cf54bc9a3= 28449ae8f326 I don't know when exactly it broke, I tested on head/r310361, the OP was running head/r310173. The problem occurs both if I include `signal(3)` via `` or `` or not at all (i.e. `loadrec`). To reproduce get the last version without the workaround from the repo: https://github.com/lonkamikaze/powerdxx/tree/93a755fbc4d7ec36e5a9d4a35d5a33= 052cc0e678 --=20 You are receiving this mail because: You are on the CC list for the bug.=