From nobody Sun Mar 23 17:24:42 2025 X-Original-To: threads@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZLNNB2LCdz5rZGs for <threads@mlmmj.nyi.freebsd.org>; Sun, 23 Mar 2025 17:24:42 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZLNNB1k8vz4440 for <threads@FreeBSD.org>; Sun, 23 Mar 2025 17:24:42 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1742750682; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J3B5HW6VmGkqrpRQkCbF70p9ICFVPTs1q9kxdIVj/6M=; b=S4ui31hsp+TCd25dYvUjDMjjZpGC84zLp0UQz/MvhUQQ/yJ71FCHVtI5ip1Bk1BSp/b2zo Vc3kUs0z4nw7omNf0dS9h2WJPK51saFzdcN/z0wmyCZQeGtvykO28c5Zt96+dPhXdinJZr LajA+bZ5X/DykFGvSqJ9cS8A8dYt9CtKTFvuMaWPMxyJStmvYZuhBZLm5sZC4D/goZqPEi WiRvHNWpQw6ZDyJ9mX/XvX26jkInAh6ahWeNkCBu+q6kVjlhLsEqTCIU2LqHtoJ2ROhm7y ZjyvCAO4AEqEGawdknJ4g1s+kvNdEQ/bFuD4dbYJ3/YCBxll/1Wb60rCp6LXPw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1742750682; a=rsa-sha256; cv=none; b=sGg+Y2plHvk5n47EfTPRCVUN2IPE+xZeNgOQBSBgQqbym5RcLdInoK/JQk0Mqpun7nxCmf moAmy/97VyBkaXSyHGXEwwo3w99wUZeHkZbth2vvVSf3u987dyMEmwyREKCQpj1sWgfEB9 PQqyb2103s0yXOSV+Ol5RtMYR3xznMqsoT6U2BCoROefbasxDpgBlVNjfLKsyOlBA4GsjK 3XyzEUCN/AT3h8/H+3geVNSR/sHVEOOJqw0Z6AwHKXJqSg0bIL8DfjuKZ82DbAR20N0okU AjfiMKFS/PH529pdB7dm3gcql/x43MgVVZ0MN+wH8Fcc+Bc3GnVWbcsM7b5YAw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1742750682; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J3B5HW6VmGkqrpRQkCbF70p9ICFVPTs1q9kxdIVj/6M=; b=xmo5puWKNQYKkD01XK3EXcOzfEoxX6VWYO3jVz4v9FDD/HfcznbyKWrDbWa/+Q12J8RLpQ 4SE3uexi9x1+oSrMzfd6ITSNm/OnTUiogN/8AL/UBOfZiaR3YJi3iBNpOi/3Ay+t4uak32 SZmv97TVMN6t4revwaS63F2w70reSK5r1e6x8NK1LGWQoO41s4ItYInwaUG+5ENcOeCNRo n+9bfwu//aPZlUMb1hxpHFEIMG9sA7v9aQOPjnS409MDErQ7BNPbxfykH/6tBUooi6pdJo 9qRRqCJmg9ZsTtwnC/I+FuRcyt2V3JdXCItueTnZyC8xFEFDCsRGUqkFXFEaIw== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ZLNNB13p0z2Bt for <threads@FreeBSD.org>; Sun, 23 Mar 2025 17:24:42 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 52NHOg90007006 for <threads@FreeBSD.org>; Sun, 23 Mar 2025 17:24:42 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 52NHOgu9007005 for threads@FreeBSD.org; Sun, 23 Mar 2025 17:24:42 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: threads@FreeBSD.org Subject: [Bug 285612] Qt thread deadlocks on destruction after fork() Date: Sun, 23 Mar 2025 17:24:42 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: arrowd@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: threads@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 attachments.created Message-ID: <bug-285612-13406@https.bugs.freebsd.org/bugzilla/> Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading <freebsd-threads.freebsd.org> List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: <mailto:threads+help@freebsd.org> List-Post: <mailto:threads@freebsd.org> List-Subscribe: <mailto:threads+subscribe@freebsd.org> List-Unsubscribe: <mailto:threads+unsubscribe@freebsd.org> X-BeenThere: freebsd-threads@freebsd.org Sender: owner-freebsd-threads@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D285612 Bug ID: 285612 Summary: Qt thread deadlocks on destruction after fork() Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: threads Assignee: threads@FreeBSD.org Reporter: arrowd@FreeBSD.org Created attachment 258950 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D258950&action= =3Dedit Testcase program This bug was haunting me since Qt 5, but only now I was able to derive a minimal testcase. I tried to replicate what Qt does to minimize even more, = but failed to do that - too much complex stuff contributes to this bug: forking, threads, thread-local storage and __cxa_atexit. When the test program is ran as ./a.out fork stuff the program successfully terminates. However, running it as ./a.out stuff fork makes the child hang in QDBusConnectionManager::~QDBusConnectionManager [1]= . A bit of debugging lead me to [2], which is an exceptionally complex piece of code. By putting prints here and there I found out that the function passed into pthread_cleanup_push in [3] does not get called in the 'stuff-fork' ca= se. Not sure if it's a problem or a symptom. 'fork-stuff': set_thread_data(non-null) destroy_current_thread_data set_thread_data(non-null) pthread_cleanup destroy_current_thread_data destroy_current_thread_data set_thread_data(null) 'stuff-fork': set_thread_data(non-null) set_thread_data(non-null) Since debugging this issue would require building Qt with debugging enabled, here's a recipe on how to get a debugging env with Poudriere: echo WITH_DEBUG_PORTS=3Ddevel/qt6-base >> /usr/local/etc/poudriere.d/make.c= onf poudriere testport -j yourjail -p yourports -i devel/qt6-base Then inside the jail: fetch https://arrowd.name/t.cpp head t.cpp (to get a c++ command line to compile the program To apply some changes to Qt itself: $EDITOR /wrkdirs/usr/ports/devel/qt6-base/work/... make WITH_DEBUG=3Dyes restage reinstall [1] https://github.com/qt/qtbase/blob/v6.8.2/src/dbus/qdbusconnectionmanager.cp= p#L117 [2] https://github.com/qt/qtbase/blob/v6.8.2/src/corelib/thread/qthread_unix.cp= p#L82 [3] https://github.com/qt/qtbase/blob/v6.8.2/src/corelib/thread/qthread_unix.cp= p#L338 --=20 You are receiving this mail because: You are the assignee for the bug.=