From nobody Fri Jul 17 16:01:34 2026 X-Original-To: apache@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 4h1vmH29Lyz6l5WC for ; Fri, 17 Jul 2026 16:01:35 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4h1vmG40qKz3wDk for ; Fri, 17 Jul 2026 16:01:34 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1784304094; 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=i6nSc1zQANHuZQWizZXVDh7OJrcsDscam1+7C3+WqHE=; b=cT+eP3zZstIYMqj1HMZEK/UzJkrYL2Nk+eFLnE/0nA1FFj6jrKsaEuEduDu5v2AQ+qx+VG NGVaEBxk78ofvFuAal8W8uNadn+E9ZOks7CZqkpIu6/irfjgU8XnRpphJzPFslKDYzDwga Hkb0WnZRHq22dZoUQWxzzF3Djey+p0pT/vipdtNtOYz0rDYxAcnhXwswnexp5rRPNRwmZh o3nAzyvwsDvxk1+UIeftCk/8pIKAUzUUd6YqqnNOzPl2FvPhjqd+u4a0pT5cDAv9CEU8GB p2nVXKTn82FKIRW4lSjN/fA7097IUZM4mWAOg5TsMEJfP3ELkX3jIlI8vcFHXA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1784304094; a=rsa-sha256; cv=none; b=H6t1DO5rKEy1gUT8TzRviMvVp7puOZiy5RtNjGrlTdLVqAu14j8WoOb4IL8TmH3i7sjhSy HXOX411gj8/1x3VDKRh/JXvMElYUNgKxmb+dhvFAc2FR3Mmfz/Ei9V9xUMjFYBvm7erer9 ZuofFp6wA2U4o85pCRhnGp+WIJ/94UtjjZY0oHIEzueL8YDuw3NTxDAi83DD4cffjTPbez BU+fj1SUnf+SXTp3l2O/jZlhw02BgSbaIl2xILUo7iEAYyDdz4o/ELlCLqj8SyYT5kkzXl EJh0o5iFTEnmZgeUxpsVbgBRNJZVCvMzb0TOF/uxTp4bobjpL9ThZ/nwGXdBaA== 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=1784304094; 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=i6nSc1zQANHuZQWizZXVDh7OJrcsDscam1+7C3+WqHE=; b=WVV1zKKdjAwmLV4+pAPNnMDPTw0moIlOvgVlE1BTsrdjwALQOlE3JWqXuJ6Szx9WEw3svw ApnH+Gnau47YAepxM9KzZYgJp0hbwEZ13tKR0/OMKiHtQqujCzEjM27tzkNcgeUMAevyVy MbH2ApzhVgiFVRJax0dTsN4Nm+kjJaEIIIZEnj+NcJEQ9Gl6EodXmEj7kfqiaEs8QJfrm+ r9oWyfXFG1VOeSpvh6z+J4lg1xML97UKhzS9CZQ0UehFPbmdFgv2IFyS0qbrZuHiA6yKiB pZNttm3hgEnGl7oKEM0cQ5S4le8JlLFNMU9aCyzhhQfLOdDz1hJ1zu6WcPOq+w== 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 4h1vmG2pWrztmV for ; Fri, 17 Jul 2026 16:01:34 +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 66HG1Y0W099700 for ; Fri, 17 Jul 2026 16:01:34 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 66HG1Y5j099698 for apache@FreeBSD.org; Fri, 17 Jul 2026 16:01:34 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: apache@FreeBSD.org Subject: [Bug 287302] www/mod_perl2: panic: MUTEX_LOCK (22) [Magic.xs:525] during global destruction. Date: Fri, 17 Jul 2026 16:01:34 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: regression X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: emil.nachev@e-card.bg X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: apache@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: cc attachments.created Message-ID: In-Reply-To: References: 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: Support of apache-related ports List-Archive: https://lists.freebsd.org/archives/freebsd-apache List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-apache@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D287302 Emil changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |emil.nachev@e-card.bg --- Comment #8 from Emil --- Created attachment 272935 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D272935&action= =3Dedit Patch for devel/p5-Variable-Magic (hopefully) fixing bug 287302 Here's a patch for devel/p5-Variable-Magic that seems to fix this issue, at least on the test environment I set up to replicate it.=20 I'm not familiar with Perl internals, so I got Claude to identify the cause. Here's the relevant part from that back-and-forth: --- xsh_user_global_teardown runs from call_atexit(xsh_teardown, ...) =E2=80=94= Perl's exit-list mechanism, which fires very early in perl_destruct(), before the ordinary sweep that frees the rest of your program's global/persistent SVs (and hence before all outstanding Variable::Magic wizards attached to them get freed). If PL_perl_destruct_le= vel is 0 at that point, the module destroys vmg_vtable_refcount_mutex right then =E2=80= =94 not deferred. Any wizard SV that gets freed later in the same teardown =E2=80=94 which is exa= ctly what's landing in vmg_vtable_free() =E2=80=94 then tries to lock a mutex that's already gone. pthread_mutex_lock on an already-destroyed mutex is precisely what FreeBSD's libthr reports as EINVAL. This also explains why neither PL_dirty nor PL_phase =3D=3D PERL_PHASE_DEST= RUCT fixed it: those flags describe when in the teardown we are, but the actual hazard is whether this specific mutex object still exists. Those are two different things, and nothing before now= was checking the right one. The module author clearly saw this hazard =E2=80=94 that's why the "late re= gistration" branch exists for destruct_level !=3D 0. But under mod_perl2 (embedded interpreter, PL_perl_destruct_level commonly left at its default of 0), you land in the unsafe immediate- destroy branch. --- The patch is simple enough. It takes care of the immediate problem by explicitly tracking the mutex; however, I'm not sure it's the best way to address it (again, not familiar with Perl internals). --=20 You are receiving this mail because: You are the assignee for the bug.=