From nobody Sun May 14 21:00:16 2023 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 4QKFJJ496Vz4C6qs for ; Sun, 14 May 2023 21:00:16 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QKFJJ2Xbwz3pHg for ; Sun, 14 May 2023 21:00:16 +0000 (UTC) (envelope-from bugzilla-noreply@FreeBSD.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684098016; 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=Bo0zQRm1ZwbiocxA+mAVZowZsIv+BCSeV+Z1hFNrJXY=; b=TuKYrwpEsV0EYBz0BkAcuUYkFE3QfCs/9BCwXkaXfasJ+1kr5qq5MpHdea29pc4EsE3yBc WBG3ocCGQ5tXS+R2P49/WrwLZf0LbJ2B9a2P6Xe9nkn6sJUHFQlxnYSuQWso/DyVzDOQui jMrh2kDaCNA9iJFcct2W4WXctl5pQD8IlRGcjvuo9yEhMRzcxJCFUfk41AcGdn2eReYEzp GIq05Lq53wPBWhETDBhaZI+EJy/dasKd6S7UtxKFSDedcsjnpbiB7XfucL+KW2H1f6NYUc zwUW1yWkXDSvn5CY1OvQLsaGowrrD8zq0vq0jQdbcTRw9a9CUmlGiSw0b71Klg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684098016; a=rsa-sha256; cv=none; b=N6e30prOcmRvRF+cl2BcyexUGRX6bhksgSMsHtq/lY0ryrvvzqi9YiLY28ZEagnslArQtq BbamGIA6koYDAc/157b6x6wFbsAhPzEgkOLTUSnkZx92mhUkTm98uQn0m5rgVQ7Wz74NDG N29m9yDWDbYne+xWJETxdTNJKW0x29mz6IpNzXguroMT2AWkhIi5r7dmzdSjOfMsvbtowJ q5XNjMHwtY+0aoZVRUqSIV4OMdoy7ojvXeVNylfAgYT41PsKZTpOM8y3BQFqqcmMW2G6+K uQIXZXlhYfxrAfbFyyIt6Et+oqaV4MiToqNQX1Mid3nEtessYncxZx0pbkIO9g== 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 4QKFJJ1fM8z1Cnj for ; Sun, 14 May 2023 21:00:16 +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 34EL0Gad087398 for ; Sun, 14 May 2023 21:00:16 GMT (envelope-from bugzilla-noreply@FreeBSD.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 34EL0GYZ087397 for threads@FreeBSD.org; Sun, 14 May 2023 21:00:16 GMT (envelope-from bugzilla-noreply@FreeBSD.org) Message-Id: <202305142100.34EL0GYZ087397@kenobi.freebsd.org> X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@FreeBSD.org using -f From: bugzilla-noreply@FreeBSD.org To: threads@FreeBSD.org Subject: Problem reports for threads@FreeBSD.org that need special attention Date: Sun, 14 May 2023 21:00:16 +0000 List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="16840980161.d0B555.85873" Content-Transfer-Encoding: 7bit X-ThisMailContainsUnwantedMimeParts: N --16840980161.d0B555.85873 Date: Sun, 14 May 2023 21:00:16 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" To view an individual PR, use: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=(Bug Id). The following is a listing of current problems submitted by FreeBSD users, which need special attention. These represent problem reports covering all versions including experimental development code and obsolete releases. Status | Bug Id | Description ------------+-----------+--------------------------------------------------- Open | 237195 | pthread_mutex_unlock crash as unlocked mutex dest 1 problems total for which you should take action. --16840980161.d0B555.85873 Date: Sun, 14 May 2023 21:00:16 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"
The following is a listing of current problems submitted by FreeBSD users,
which need special attention. These represent problem reports covering
all versions including experimental development code and obsolete releases.

Status      |    Bug Id | Description
------------+-----------+---------------------------------------------------
Open        |    237195 | pthread_mutex_unlock crash as unlocked mutex dest

1 problems total for which you should take action.
--16840980161.d0B555.85873-- From nobody Thu May 18 13:22:04 2023 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 4QMVxm5DzQz4BYYV for ; Thu, 18 May 2023 13:22:04 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QMVxm2hb9z47Nf for ; Thu, 18 May 2023 13:22:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684416124; 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=O0UT/chQb6KkbJRs39rRqEq56chqKBiUwEXwUzsQiA4=; b=Cz4taf3A11PywAGT6jMQXO8bIZ128t77sUHItfRaH2iP66G3/mofn4LwGliPLMYckNnFHY 1+gygMVvQKIwu+PTYlcIVjwlRyeA5YT5ZjjM1iLNIrndo66+kRMpNCYZhjrWHRK6LpmtiN 4t3cvgk0mh75+z08EO4GD5n76BA3+2IjtLSsU4w0iIURcqhpHZkcOFMadeAewROr9msNH0 z6n06bNrKsosfPiaP+n69b5iPyXXbsF8qvv+B6+mljLp3vNNdocnJq6AE29+9ENurwscYo wmjfGNoFiLYiVIOOeLZjYKH69tUrAlzarzgQfatug9rRxeH/PWor8Rv0W4d/4A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684416124; a=rsa-sha256; cv=none; b=u5nTJFOh3RdTN9vxu8k6xKfyY2jBWzaYy7Bp9I1cIgEqLrSqwEQQc0n2MQuOhgHoAUHWEw UTGF5nds1O3ef/iLYN6d8ZAeBCREZletsg+ZDgpPLSYAMEL149cKeawdNJZtpowU9n1Pa/ UZFpkJlBuIdHvbUUKCgfD5fwhG+Qq/7M7WFQwP7iW/ueECTk2+MTCCjwv5oam7hibx3gGo 99cwGR7JYodI8AF1ebBfT449cg/qbQhRAuBKKBE2zHGKQHAiqziq4V8FlxzFcufss5P1Xr VhklENYWEwpbILilTFauJ0A2hdiaPnF3Jke787wUpsjGoTUa+rPkljW+AO7A2Q== 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 4QMVxm1nf5zn6V for ; Thu, 18 May 2023 13:22:04 +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 34IDM4Hi096411 for ; Thu, 18 May 2023 13:22:04 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 34IDM4v2096410 for threads@FreeBSD.org; Thu, 18 May 2023 13:22:04 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 271490] Deadlock between _rtld_atfork_pre and _thr_attr_init Date: Thu, 18 May 2023 13:22:04 +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: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kj@kjtsanaktsidis.id.au 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: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271490 Bug ID: 271490 Summary: Deadlock between _rtld_atfork_pre and _thr_attr_init Product: Base System Version: 13.2-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Some People Priority: --- Component: threads Assignee: threads@FreeBSD.org Reporter: kj@kjtsanaktsidis.id.au Created attachment 242250 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D242250&action= =3Dedit GDB output from my stuck process I'm working on fixing some test failures in Ruby on FreeBSD, and I've found what I think is a deadlock in FreeBSD between two threads, one of which is forking and one of which is just starting. The Ruby test which does this looks something like the following: ``` require 'timeout' def test_daemon_no_threads data =3D Timeout.timeout(3) do IO.popen("-") do |f| break f.readlines.map(&:chomp) if f th =3D Thread.start { sleep 3 } Process.daemon(true, true) puts "this is sometimes never reached!" end end end ``` The test forks, and then in the child, starts a thread and then forks again (via a call to daemon(3)). On my machine, this will semi-reliably produce a deadlock inside the call to `Process.daemon` (and before the second fork actually takes place). The thread calling `daemon(3)` gets stuck acquiring locks in `_rtld_atfork_pre`, whilst the new thread (the one which is starte= d as `Thread.start { sleep 3 }` is stuck inside jemalloc's `extent_deactivate` as part of a call to `_thr_attr_init`. --- To reproduce this in the Ruby source, one can checkout the latest Ruby mast= er from github.com/ruby/ruby.git, do the autoconf/configure dance, run `make`,= and then run ``` while ./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=3D.ex= t -- ./test/runner.rb test/ruby/test_process.rb -n test_daemon_no_threads; do ec= ho "ok"; done; ``` On my machine, this will eventually get stuck forever in the test.=20 n.b. - if you find the test failing for this reason - http://rubyci.s3.amazonaws.com/freebsd13/ruby-master/log/20230517T003001Z.f= ail.html.gz - that's a _different_ issue, in Ruby itself, that I am trying to fix - tha= t's how I discovered this deadlock thing... --- I've attached a pair of backtraces I got from attaching gdb to the process.= I don't really know where to go from here to debug the issue though; I can't = seem to make it happen in a similar C program, and by inspection I can't really = see why there's a deadlock at all. I can't work out why the forking thread would hold any jemalloc locks, and I _really_ can't see why the new thread would = hold any rtld locks. Any thoughts? Thanks! --=20 You are receiving this mail because: You are the assignee for the bug.= From nobody Thu May 18 17:44:25 2023 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 4QMcmV4ps1z4Bpt9 for ; Thu, 18 May 2023 17:44:26 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QMcmV3jYvz4c9C for ; Thu, 18 May 2023 17:44:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684431866; 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: in-reply-to:in-reply-to:references:references; bh=6Lkwqad4SU7xx/PyuBaaeLQTfcJN1hPUi/dpv9kq8rc=; b=inLSgswdYls0/QGk6p/cP8r1JVHK60b3/VtG72DHUoNHT4mwEh7aEzALwZ/nk0b0kFSLdz L83hwKksqg4fXooJmJ/rwPpsLxbHFEH/m4s/djLTBSZAFUn/qTiGjnDqcWef4ZpMlvu55c p6qjAZkTbUlqN3xmUy4g5tLyErF45BoVh3Bd2vEPDN0xA7I2zgj2eMRdPjLfC6nu3Sld6a 2NxXGaFSQ7NmCL+JKhDm3T6gt30NUF5IqlclE7wSzZEnMUllheR8U2AbPFagTLetdHDctb gn0JYkzHNsdGDv3NyaNp3atdn6rkVf4ORXkYi8/oMynOtXZWyJhOdyx+ZsTyIg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684431866; a=rsa-sha256; cv=none; b=Fp6jfgXcgfTRR5whKN5VY68eZk/cMY6e5+xD5Q8xj57d6eMkmRLb4HiUNTWpFshHnLQOGd CMwOFrjJqwD19CD8Z8Tchn0jfmnZJ+nABmb2/JwOTKH9+XsiFPkwaQnicgUOUywLyd5aDA IfaEs1OePoDf344P69o6NcHxuleE65G+vdMrM1ra2KFSZsnKmC2vDDCjBRzG5EkBygMEyM 343tmmcCNhK5/ZOlxZYx/2pUVXrGY7wNnbSg3+BS1xqipoezADxv3usxhAUOgFzktYh7TM SIvd5iMmzTooB5KEkCCsSDg1zEdDD6IJ7EOxU+Ywpd3d5WBwNCCTWItPsh87zg== 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 4QMcmV2gXxzvqj for ; Thu, 18 May 2023 17:44:26 +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 34IHiQcW095408 for ; Thu, 18 May 2023 17:44:26 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 34IHiQlZ095407 for threads@FreeBSD.org; Thu, 18 May 2023 17:44:26 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 271490] Deadlock between _rtld_atfork_pre and _thr_attr_init Date: Thu, 18 May 2023 17:44:25 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kib@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: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271490 Konstantin Belousov changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kib@FreeBSD.org --- Comment #1 from Konstantin Belousov --- Yes, this is indeed a bug in jemalloc. It seems that the problem is that malloc_mutex_prefork() from jemalloc/src/mutex.c does not lock _all_ jemall= oc mutexes, in particular, the extent mtx. OTOH, note that after fork(), in multi-threaded process child, only async-signal safe functions are guaranteed to work. --=20 You are receiving this mail because: You are the assignee for the bug.= From nobody Fri May 19 00:40:21 2023 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 4QMp0Q0kxpz4CCqw for ; Fri, 19 May 2023 00:40:22 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QMp0P6nD7z4HHm for ; Fri, 19 May 2023 00:40:21 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684456822; 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: in-reply-to:in-reply-to:references:references; bh=T3Wa47iyydpURx+EZgOJsvREN0PhSP/b3Imy0IR5KWQ=; b=qy66hmmxhA0PZMT1xdLZaxCnGQnfiU4W9eOEhWfear+lphD5HGNprwV0TFBMW7OBCJEpGc 2TucKXFGLpohP8rgY0R1AIId9ywSZkDKU0PF/dtxKDFFebQF0zSbY5uxVsWMDq7fSyKjGG 8f2FYTeX+82yBubQvegNQpEaYUvS2fYLbeBz8XNs+FySyz0KU1VEOcSsQSo5DonMwAJGWQ /jl7siCeP63zIWndiG6EBCAZ/PHlNx7KFGrxgqOzENxotIxYmb/lm9oNWVoi9FwrXsQMR7 95f+QkQNb5sbniZnCa2/i/HRury4ArhguIAaOdSJBLUV8rrJfcO2xLz/EJZ6sA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684456822; a=rsa-sha256; cv=none; b=l7jp2BfG+uBKwkPs/tgmOQgifOI7ZvwAQSbrLNgwytPPGiKyZKkVy9aMfmOxF5eIdpMjfz VYVnqcasrpd3B8f5AGiS9OK/4V4V+mHipkghXgIirlt32XHiappqQuF63FKuAjZHXTps9m 8xzYROMiaUq5/8dAzowTBWr9eqaw0T53fVEuguOQ4YsRbq+YqRmxMZ6QdILDCQyPBWlY5K 9N6hitPdcQ2CgUSLGQZQPKbAVD6/iApv9x/vWFxMGFHtvZ7RdXnzZV2kzWpiaspGLMX//Z K/WvqPzGkF8wKUSI7RF4BZQI6SACHEl72ag524/JYSqN8hp3gyNgvNc5v0VVCA== 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 4QMp0P5ljTz16vP for ; Fri, 19 May 2023 00:40:21 +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 34J0eLNR002495 for ; Fri, 19 May 2023 00:40:21 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 34J0eL2e002494 for threads@FreeBSD.org; Fri, 19 May 2023 00:40:21 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 271490] Deadlock between _rtld_atfork_pre and _thr_attr_init Date: Fri, 19 May 2023 00:40:21 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kj@kjtsanaktsidis.id.au X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271490 --- Comment #2 from KJ Tsanaktsidis --- Thanks for your quick eyes. > It seems that the problem is that malloc_mutex_prefork() from jemalloc/src/mutex.c does not lock _all_ jemall= oc mutexes, in particular, the extent mtx. I guess I could try patching this and see if it makes the deadlocks on my machine go away. I'll give it a go over the weekend and report back! > OTOH, note that after fork(), in multi-threaded process child, only async= -signal safe functions are guaranteed to work. Yeah.... this is unfortunately very common in the Ruby world though, becaus= e of a combination of two things: * Gems (especially gems by monitoring providers like Datadog, Sentry, NewRe= lic, etc) that maintain background threads (to e.g. report metrics & exceptions asynchronously to some central service) * Pre-forking webservers (like Unicorn) are frequently used to get good use= of multi-core machines (since only one Ruby thread can run Ruby code at a time= ). These webservers often load all of an applications gems, and _then_ fork workers, to get good use of shared copy-on-write pages. Most gems that maintain background threads install after_fork hooks to rest= art them when they're used inside preforking webservers. The documentation for fork(2) does say: > The FreeBSD implementation of fork() provides a usable malloc(3), and rtl= d(1) services in the child process. when referring to multi-threaded forks, so I guess _this_ is supposed to wo= rk. I do note however that the man page says nothing about DNS resolution worki= ng in the child of a multithreaded fork :/ but that's a problem for another day (maybe Ruby ensures that the resolver is not in use before forking? I haven= 't looked) --=20 You are receiving this mail because: You are the assignee for the bug.= From nobody Fri May 19 04:26:50 2023 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 4QMv1m3Gzdz4BQM9 for ; Fri, 19 May 2023 04:26:52 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QMv1m2HgCz3KWb for ; Fri, 19 May 2023 04:26:52 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684470412; 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: in-reply-to:in-reply-to:references:references; bh=6iF20o09AbgWAFnZoRfCKS2b+Khbcqtyyybh2gE/pY8=; b=xB8p7+pFTP1WF1sYwqJ8JjCrRsP60duZwoD0pZZ+3ldcXHS0cMpS4bQIcDP0+7kivcI4to XMHMZytxl5ApBuD+FIgWcLG+OGgRmspd+j/sm3K0xXnD+PHqZBwXPnpuKorwJW6r76f3bh fNze5gLKMtJhJppjmW1YcXYmixIVzpMQujFt3vKhq+ajPNaCz7UFNNM6EY4h3XdUI2CAsK 3dGudlzZ6gdlAvQWL7ES2V7Z6fV4kTh2gWpR63MfUHvuRqgp0gH2OyJYnjqCSutYkO/voj xxDCDHyMpRBgnKN0x0g6i7h5gbCEoiONHX7NxmwDFRfjs7gj4ITfisXTUMWCcA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684470412; a=rsa-sha256; cv=none; b=Ua3eJBJhKLjzdPzN5xGYqBKAMxgyehuWsttfPNtbpTFzWvVEdfPOxzURvJHuqtJ+D9Oqul pvLwbGCznqLUMj/qKl6lVTtlsg4Yh3FO+UCecED5bWkZn/Bhm9X7XBc+VwoYcPJg8cT40f yiJb9I3SOYGMlSPnvto4QJcg4UFY0ogeZuXwcABPVFiGobNfZQrWmQvGKP3SdJpsacjMNb 3JACXp5MFj5epgAAoal+Wgz5WGrNt86uhqHAi1Gs5QcYggIkyzZM82+OWmdbBTP1ZcDXJH it9/gvalDJvSkqBGnQPkEoSA174wdk+wnhnU5xakZWX8gy4E45Ijwk1Um0ZBDg== 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 4QMv1m1NMjzDr0 for ; Fri, 19 May 2023 04:26:52 +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 34J4Qq2Q046016 for ; Fri, 19 May 2023 04:26:52 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 34J4Qqh8046015 for threads@FreeBSD.org; Fri, 19 May 2023 04:26:52 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 271490] Deadlock between _rtld_atfork_pre and _thr_attr_init Date: Fri, 19 May 2023 04:26:50 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kib@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: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271490 --- Comment #3 from Konstantin Belousov --- Yes, I was too optimistic in stating that in the fork(2) man page. Problem with the complete fix is that all jemalloc(2) locks needs to be tak= en in pre-fork hook, in the right order. --=20 You are receiving this mail because: You are the assignee for the bug.= From nobody Fri May 19 05:31:22 2023 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 4QMwSB5RBMz4BTvp for ; Fri, 19 May 2023 05:31:22 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QMwSB40lwz3R7J for ; Fri, 19 May 2023 05:31:22 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684474282; 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: in-reply-to:in-reply-to:references:references; bh=Xc9bajUbJIQcMxWJ48fr//UZbqktIK72gx3XzX8PdE0=; b=gDuEAvDKsl4IhjFs8zOjAvYJ2l0ixMBDFptIV/3oPxG1Ai0MuwTrxJrILdxUDQuBsC747s o/f4CFYTE4l+Eo2B8sDvUzvNV8IECRwlrJKkW4lkX2vQWtcDXHIc4Netmq9CEU9dyYqYyu LWtT8NgsX5h1x3GuWdOHpeETugnwXdYxnKKjH1otvLYTS3V9mu2p+Cx4FbelgB1ILTfH/r DFsJneq2tuMLsFCgHTZOYNnpaI11bmDpAQlK3zy1ndDQAJvTHqSsa7ufA8KLLFTbI94ePc oqsE5CzNFO6w/atcNUeMUTfb+GakbY/CBaBfVy71ANQNE9Btl+0b0Mi947Bsfw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684474282; a=rsa-sha256; cv=none; b=uUTp6vfbstfz412idBQ3+ptcTG0Q5v8gIqK9wVMgGRy4fV8qWUlnBuoL2NxF8yXs1ZovBQ 2ZkXm28FRpBTXFNCZM9W0b6krMiTum+QaoPMu5ADinL78R6HwwRzVuDkfcfoPDFdT6Bk5k Q6neQKoDLoqw0RtGH5ZwS12K0UDmgL3lX6aETyyFlyDvLm0YE3ePJ9/w0zACV9w68swi2P V0hKLN9fWc3N/Ec8/H3ie7u+j6O2lPdtoIICu3ecESlhHkkPG4/aMIoUgfvITLt6kiHhTp mZ85KbOUUJerAAdPCcXVY/VDBCYI4y+4iZ95xI18wNaU3JrDeJAILQ46lrBzQg== 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 4QMwSB2ztpzGDm for ; Fri, 19 May 2023 05:31:22 +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 34J5VMo1040040 for ; Fri, 19 May 2023 05:31:22 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 34J5VM8d040039 for threads@FreeBSD.org; Fri, 19 May 2023 05:31:22 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 271490] Deadlock between _rtld_atfork_pre and _thr_attr_init Date: Fri, 19 May 2023 05:31:22 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kib@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: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271490 --- Comment #4 from Konstantin Belousov --- Can you please provide me the stand-alone ruby program that demonstrates the problem in non-disputable way, and the exact instructions how to launch it? --=20 You are receiving this mail because: You are the assignee for the bug.= From nobody Fri May 19 11:20:15 2023 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 4QN4Bm2RLjz4Bpld for ; Fri, 19 May 2023 11:20:16 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QN4Bl4lskz4VWj for ; Fri, 19 May 2023 11:20:15 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684495215; 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: in-reply-to:in-reply-to:references:references; bh=YnHlZUcIR8IyFjh7YFBu798HkbR5Vs+xSUO7tNSpzBg=; b=kbSKEuyhZbPryuHhomEGLJLoO7g0c/jqCYBKt7y892R5j2OaFqor0JnTsbKW4MQUmSC5Z7 w9ZaIk+++t2hDZus4xdmy1jLGGYt7DoR6/FxP3R2Cf17gpYQ7hveMEoCyyPkRf6z2wpLli 5Fn90bpTty5wrMgiQEWBX9zgchtx6XyQnhmYLU2XTuvybEdnFXxxxw3pQNEiUwEM1RSjep +lUnHiIlMeil6BOFDJy6Fi+T0cCN332SIbvJAXivGXjDAcRsWt0r+AJxvo8YC6313UGiiI G+TxRLvMoRhMz9M3HnyB8vkM5iFDB1IvV60gzqs0xCK1VJWpRou0M24Uz6Nxew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684495215; a=rsa-sha256; cv=none; b=bo+YoMDMbvCNbvSbj5wSyNoLpHzHv5bwvIBHa7PN9sFyo14zFLrAh6OvNoWiPojSJ2avCr r/ME+SHIwI9SrbBQmE5eTXY3XSYFxMLjHmqwn4HG4Segm5yhfyAH+0AUS1twyCXjHAuOA5 FHeVJwoULMnD33fp7S1aD/h5sgMGZ47Rpl3ZcX4yTrDOqrIkX/m7mo8GoaItBKrbLKmNzo 2ufBgJ9gYIjUjMFr+PBeVxqnjlwfRgFdGyba6FzTs+8Bp6/xVsfCyjjP7f3UND5LJfTlyE iX87WCfC4NTzfUVyaa+RDhO+UYKj+IBbNkge62gREweMlpvjnnNHjkjiCAnGCQ== 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 4QN4Bl3lNvzQSJ for ; Fri, 19 May 2023 11:20:15 +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 34JBKF1T049458 for ; Fri, 19 May 2023 11:20:15 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 34JBKFFO049457 for threads@FreeBSD.org; Fri, 19 May 2023 11:20:15 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 271490] Deadlock between _rtld_atfork_pre and _thr_attr_init Date: Fri, 19 May 2023 11:20:15 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kj@kjtsanaktsidis.id.au X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271490 --- Comment #5 from KJ Tsanaktsidis --- > Can you please provide me the stand-alone ruby program that demonstrates = the problem in non-disputable way, and the exact instructions how to launch it? Unfortunately I still haven't been able to isolate the problem outside of t= he actual Ruby test harness.... so this is all a bit involved. I've been tryin= g to develop a minimal reproduction (with either C or Ruby) but I haven't had any luck so far. * You'll need `git`, `autoconf`, `automake`, `bison`, `m4`, `libffi`, `libunwind`, and `libyaml`. * Clone my Ruby fork: `git clone https://github.com/KJTsanaktsidis/ruby.git` * Check out this commit (includes some _other_ fixes necessary to surface t= his problem): `git checkout d5471e6e1e8b81d7c7e960538d138868db0e0707` * `autoreconf -fi` * `./configure` (I don't think any particular flags are needed) * `make` Then, use the built ruby to run this particular test in a loop, until eventually it hangs: ``` while ./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=3D.ex= t -- ./test/runner.rb test/ruby/test_process.rb -n test_daemon_no_threads; do ec= ho "ok"; done; ``` --=20 You are receiving this mail because: You are the assignee for the bug.= From nobody Fri May 19 11:20:55 2023 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 4QN4CW52bHz4Bpll for ; Fri, 19 May 2023 11:20:55 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QN4CW2TNfz4Vkc for ; Fri, 19 May 2023 11:20:55 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684495255; 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: in-reply-to:in-reply-to:references:references; bh=3GFX49WMIWibJrMRxnXCJ3RGh6DzTiYpkOqOEd9N7+A=; b=d/Hf96B9y9J5uw4asbcgVV6WHvTJyPbwbiJm3kfhv3m7wbgAVOsKUXM8I6K/pRWGMyvJ1C QltT6JVUOBYfHazNkZOGVbPYljTZptHXDIqJDsLNlRh6+KBCA+3/XyleXeT1oN6dD86p4e m3o6XLJA4Se69kCBWAi3d2XfCyWDJaGKpEiw6ola1+pGxcZDn/9cdfxTTBSQvdJwU6rxGG +2CHU1YW/nAlusy+iPxHwlsBJNUKG8/7dDFTtbZooNBw6QmaBq6UW2si6qMbUwikzGmbvl NXS9kDzAD48aXBeUl+NDbclZIPfAlkmdzuoqeeKtOdJ1ikvDHCs4t28lLVX3ag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684495255; a=rsa-sha256; cv=none; b=E6lX9xuR9nnPK6rc/6KzVteMny0MmX3l0FgKxqxcnAYJ95RQZR9WFIbvjbGAauoj3p3nA8 dPI32VOD+I7d6ycOI3nPCA/BLPKO6G6GqGfBJFX4FgdMegM3nauDP8KWsSXGi9LHqbkCRb odXE59XEdG5/rKAS2yDnzPHNDEdvEs0Cg04q0D5ZhbIT1qd08ZzElqn2VN4wiuj9U+I6KS iCjIIf7AqM5z3rzmKPdmvcIdGu1IMOh+qQkK3bJ5j/9c5YeYkbGytTaDfekqEnCgZ6hkOc RJKM+kWYx8GgAi8HNbkhsdiT+GNvNWFmrvIy7EHDftevKggX0TlgrY2arGRiAA== 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 4QN4CW1ZWbzQSV for ; Fri, 19 May 2023 11:20:55 +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 34JBKtAI052087 for ; Fri, 19 May 2023 11:20:55 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 34JBKt5K052086 for threads@FreeBSD.org; Fri, 19 May 2023 11:20:55 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 271490] Deadlock between _rtld_atfork_pre and _thr_attr_init Date: Fri, 19 May 2023 11:20:55 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kj@kjtsanaktsidis.id.au X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271490 --- Comment #6 from KJ Tsanaktsidis --- Created attachment 242274 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D242274&action= =3Dedit Another gdb backtrace of the problem --=20 You are receiving this mail because: You are the assignee for the bug.= From nobody Fri May 19 11:24:49 2023 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 4QN4J12Zrmz4BqVc for ; Fri, 19 May 2023 11:24:49 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QN4J11ZXzz4VxS for ; Fri, 19 May 2023 11:24:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684495489; 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: in-reply-to:in-reply-to:references:references; bh=didJ2D+kFiCy0e8LSdsbFOKnIOptyIoFkzNlZCa4WXI=; b=TsfcnYCraYbqCktzvQRJLYlt1y/dBo2FbeHcCKx6SbdYxWlFoiwNOIGURQvPCHsBbid/TV g7jZs53M+gNaQ0kc8rYuAAd5ZFzjj6YEpMzy4/3TYFZJHC45B8SdaqFcSoMT2uNghslCnV tXHjHJl6Hz7JU3jb8rOa0UBbqQ3Lwzspvp2wvUlcrnkSWgfP4mezXZSQWnSQli+knmj9XZ FqBEp7uUGnXhholD/tVIaglpu9kQVC35Jxhhf5xBdNVozbT2xoAlj98XT/bRg7SB1Fv+jz Mn8fhGLNWNxYmkiE91e8Mf5HeRsj9X5zKGMFs9WwzputhQ1whKd1zBnfhwboXg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684495489; a=rsa-sha256; cv=none; b=hmL+Uz+8T3Q2UkkYuSSccelbG80j175ioAVc0guKwqyjjjz41bGo80dCoYsLq+kmAsxMvG I7UhIAGdzSB3kO9eeM9KLDwfrYmBgiqsrle/tOjLhsxNw4yroQSIO22fQWrImURatBqzvl MJR0mCv4ZaiFLQvx5N0NGgjy13dud4jzUDd6S7KQ5QMsR0c74TnkX1xfIorFGWiINpP2eN DIhliwK1CYJgFs0gO0huL8s8MQ7SH3OGDqF9CD/I51pWQbgahW2bFpTFkd8LHrgBdK8Uzy OTuLp3+F2N1jukjvKuPrV+z6kTMo2MMINIDuBA4c2xtlSC7f9KoMdtPYQppt3g== 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 4QN4J10V6YzQk8 for ; Fri, 19 May 2023 11:24:49 +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 34JBOnx7061913 for ; Fri, 19 May 2023 11:24:49 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 34JBOn9O061912 for threads@FreeBSD.org; Fri, 19 May 2023 11:24:49 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 271490] Deadlock between _rtld_atfork_pre and _thr_attr_init Date: Fri, 19 May 2023 11:24:49 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kj@kjtsanaktsidis.id.au X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271490 --- Comment #7 from KJ Tsanaktsidis --- I did make a bit more progress debugging the issue though - I don't think t= he problem has anything to do with jemalloc at all - it's _just_ an RTLD issue. I captured a different backtrace of the problem and attached it. In this one thread #2 is just sitting there chilling on an unrelated mutex; it is _not_ doing any jemalloc things. So, thread #1 manages to get deadlocked during `_rtld_atfork_pre` all by itself. In particular, it's blocked acquiring the `rtld_bind_lock` in write mode, a= nd the lock appears to already be held in write mode (by who??): ``` (gdb) print *((struct rtld_lock *)lock) $21 =3D {lock =3D {rw_state =3D -1610612736, rw_flags =3D 2, rw_blocked_rea= ders =3D 1, rw_blocked_writers =3D 0, rw_spare =3D {0, 0, 0, 0}}, _pad =3D '\000' } # bitmask against URWLOCK constants, from https://github.com/freebsd/freebsd-src/blob/1377eb268a5a8a5573bda33a6519632= 59c43c3ed/sys/sys/umtx.h#L62 (gdb) print /x ((struct rtld_lock *)lock)->lock.rw_state & 0x80000000U $22 =3D 0x80000000 (gdb) print /x ((struct rtld_lock *)lock)->lock.rw_state & 0x40000000U $23 =3D 0x0 (gdb) print /x ((struct rtld_lock *)lock)->lock.rw_state & 0x1FFFFFFFU $24 =3D 0x0 (gdb) ``` Also also, I'm not 100% sure yet that this wasn't just luck so far, but it _seems_ I can avoid the deadlock by setting `LD_BIND_NOW`... Anyway I'll keep hunting for an isolated reproduction. If you have a stab in the dark though I'm happy to try a patch as well. --=20 You are receiving this mail because: You are the assignee for the bug.= From nobody Fri May 19 11:52:13 2023 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 4QN4vf0xxfz4BrWW for ; Fri, 19 May 2023 11:52:14 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QN4vd4m3pz4bg0 for ; Fri, 19 May 2023 11:52:13 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684497133; 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: in-reply-to:in-reply-to:references:references; bh=Ve4epYCru8PICxsK7gZGZ+o6OLS8PJ5yTl4X/orQvus=; b=aHc8shRmhpefclIjWB33vq2isRWswzFwDaaTCyj+kA4Ct9lBPS3f5PqRgsHY7Ns9st48wi SMnuUyItlATBYm1ustVmja/OFaVbo3KvybU4wZkY7KZ9x28EW8AOGChfueloLpWUdJ+yhs pvy5XOpCQuNyYiHCL+5n+Q1XJHALyhr+oxKphOw1RtIe4NFeifqu+n8epJtl7/3Ne++udR Ig5Q5BnCtKH89RH0v2gX7WtvBWsDyN8JsktKZI5FjaO0ZeyoNndKT60I08ZTOuyFzr9VNn jyBYvSePX6t4BYpFGgNMpWcE6F+Xgx7VtaK9qHAg4kYG/P2b5BfcPqCAmHlVeg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684497133; a=rsa-sha256; cv=none; b=DoLPeAJer3UwDLrrlURR8he0R5LqlGL0tKTJAgIkiAVVuvn+DtkrFkVN0apv3Uq68hpZO1 BsFDeLgoCysxFTfW/rXtRQsx4d9bibTNZi7yHk0IJ7e/oQQlOpk0CxE+IP0P+vN76OVdpG zdZTypjnt3i3nbZnacQq7eYwpnHP+bIGOy9VQZu7kNBKWdYPyR5sCASyu95HMThJfjtW3R nIaHK+VE1OMneSz2596d952WnJM4V41Mln/l3aKbsbs6p6heRCLw3rx8TrI8ZdHN/A1vYT dJO7yZmEq9eyTJGfJiPXMeihDkvHkUozdQhsg8YMyqDB0+Z/tI/B8iyVdknoDw== 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 4QN4vd3sKlzRTL for ; Fri, 19 May 2023 11:52:13 +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 34JBqDQI099052 for ; Fri, 19 May 2023 11:52:13 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 34JBqDVL099051 for threads@FreeBSD.org; Fri, 19 May 2023 11:52:13 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 271490] Deadlock between _rtld_atfork_pre and _thr_attr_init Date: Fri, 19 May 2023 11:52:13 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kj@kjtsanaktsidis.id.au X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.mimetype attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271490 KJ Tsanaktsidis changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #242275|text/x-csrc |text/plain mime type| | --- Comment #8 from KJ Tsanaktsidis --- Created attachment 242275 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D242275&action= =3Dedit Isolated reproduction of the issue --=20 You are receiving this mail because: You are the assignee for the bug.= From nobody Fri May 19 11:56:04 2023 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 4QN5050Mk0z4Brhf for ; Fri, 19 May 2023 11:56:05 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QN5046MJvz4cxX for ; Fri, 19 May 2023 11:56:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684497364; 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: in-reply-to:in-reply-to:references:references; bh=FQ5Nan0TczfWJpUlaG0eGprr0+nFCSUDdfvCnaGm4HM=; b=kXfYb8VsKzx0CAo1W5oZsvcOla7jXVFxUfI7U75006EnFITLX6rSFTh3pqiKrroluYCi2K lAEo/glZQWfCNZM1J9Xx+n1LZO7I5HlOWidk/YSSta3LMitxNRG01Yx5ho4RFbgkP3EsaY Avqg6r14iAlvt1KAf5iDRQl0FiZ0a9Mf9Gu/MgeATFE7tqzOLdfpLsa1R38UBdxdEAlII5 8hFnguVjfyGVZy+yOxlKkheZKXYsVzTBjxLWtyDH5jDCnNBob0fEaU//rtJpkMjJyMRWxs g2ze4Ta8ZyFcdJO/rOBJ20r6gS/RWmbGi3SF8qNEv1M9KTXVnlAb9KZAeBGLoA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684497364; a=rsa-sha256; cv=none; b=eep9MEJ1AmOT2bjjBTUGCEsvHtggyoxOsf3K4pH34E91CZqv4QrFoxNhkLZJwX4u9aJmSY +U3v8/fU+jLTfpnNXHHjY+iJkfTuxv2PMh6PCbBklMWKiZ1npeBaJdiuVSmwPtT74raapz mLAEUASu2pTBSouGJ26FDOhkILaGdcPbjIhc6m9ztkT4rUPajMMOMdIXdUTX18qc4ZCVsp uODA/wxocR7Eo18l+zLZqA9BsQODki8mel0wWhnykh2jUUipJhN1UHjsvq+VcIhDoE4IoQ U68UaDAGgujX2PYloAnG2lBTNSD6IeAO9PfRnOShJEDf6v2keYFI3m0q9wID0A== 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 4QN5045MQ4zRrh for ; Fri, 19 May 2023 11:56:04 +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 34JBu4Yg005216 for ; Fri, 19 May 2023 11:56:04 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 34JBu4xx005215 for threads@FreeBSD.org; Fri, 19 May 2023 11:56:04 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 271490] Deadlock between _rtld_atfork_pre and _thr_attr_init Date: Fri, 19 May 2023 11:56:04 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kj@kjtsanaktsidis.id.au X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271490 --- Comment #9 from KJ Tsanaktsidis --- Ahah! I managed to make an isolated program which causes the issue. See the file `reproduction.c` I added as an attachment. This will eventually hang not printing anything, and attaching GDB to the c= hild process (not the parent) will show a similar stack trace going through `_rtld_atfork_pre`: ``` clang -std=3Dc11 reproduction.c -lpthread -o reproduction while true; do ./reproduction; done; ``` However, this will _NOT_ hang: ``` while true; do LD_BIND_NOW=3Dyes ./reproduction; done; ``` (on my machine, in any case). The trick seems to be doing a multithreaded fork, followed by _another_ multithreaded fork. Thanks again for having a look at this Konstantin! --=20 You are receiving this mail because: You are the assignee for the bug.= From nobody Sat May 20 08:11:32 2023 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 4QNbyX4VNbz4Bm7b for ; Sat, 20 May 2023 08:11:32 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QNbyW73R3z3R4B for ; Sat, 20 May 2023 08:11:31 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684570292; 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: in-reply-to:in-reply-to:references:references; bh=5WXjfq375X5S29e4sZxxkC/QAwo9bmT5hGxWPS61OL4=; b=GJTUtElq/HEmE5YIn306b+Pn+xVYSexuyeNUwFC387amUt34GqZiPa4fWVt4jd2kj0l5Sn bKbZOYGWgohuZZdX3AGHXmlQA+kz73oPDRC/asrP1YmomAwaDgKpht5ml7nggK9sbtM4b6 0oWfNObIGboZ1A9mHwxPKaVDx3Z591yy6OI0bfzq3eLXNbvTu2uBTCGnvXOjTyMJ0sPKsX 9OM0H4rLRMyP1HS2qfMsSsY97zH2ROsQK3rjWlXnWi+TsZOZkTiNH7yYRqJCMXUkbjLzdT 67Xh8QTF+BzJKQmiWs+hw9QPNLZSlCqh39qs3rHU3O+Z/xiPTGrf+3kSGLjwPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684570292; a=rsa-sha256; cv=none; b=PxJpCtmle8munVO+4owyzqiF8Xa7OMQSjEQyiOrsND2gSIH59MZvn9lmvQW9Evz/ym6iU7 XdReGGFhRTlaApc5SuVqxRikCUkhsxxf+lh+3eLPrSKT0NmZBLSvOxcrc49W99O7NJ61RA ZoHycUzW6RSHLP4oLiyD0K9MG+cPNWA7fedUcveLuHWiRjaziSIzmy4sXDX+89q4XGgbR2 yoEZse61silhuOZTFmTa2GU73qqKFy43jMtbMQU8bLIe7kzLw1DvEFFX8iFvCa1WYe82im X7eQ/LTSJbydP74y/A1GJVkYpWZbSli1jePXLjmUpa3RiMJ182K+hD0+SXPoXg== 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 4QNbyW53kMz11wM for ; Sat, 20 May 2023 08:11:31 +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 34K8BVqQ092573 for ; Sat, 20 May 2023 08:11:31 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 34K8BV78092572 for threads@FreeBSD.org; Sat, 20 May 2023 08:11:31 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 271490] Deadlock between _rtld_atfork_pre and _thr_attr_init Date: Sat, 20 May 2023 08:11:32 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: kib@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: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271490 --- Comment #10 from Konstantin Belousov --- Please try the following. Does the patch help in your settings? I am esp. interested in the ruby test. diff --git a/lib/libthr/thread/thr_rtld.c b/lib/libthr/thread/thr_rtld.c index a9d1924967a7..c9c4871bab54 100644 --- a/lib/libthr/thread/thr_rtld.c +++ b/lib/libthr/thread/thr_rtld.c @@ -80,7 +80,7 @@ _thr_rtld_lock_create(void) busy_places |=3D (1 << locki); l =3D &lock_place[locki]; - l->lock.rw_flags =3D URWLOCK_PREFER_READER; +// l->lock.rw_flags =3D URWLOCK_PREFER_READER; return (l); } --=20 You are receiving this mail because: You are the assignee for the bug.=