Running Znuny OTRS in a FreeBSD Jail with apache24 and mod_perl2 Upgrade perl5-5.36.3_2 to perl5-5.40.2_2 needed packages have been rebuild successful in clean environment. [...] ap24-mod_authnz_external24-3.3.3 Allows users authentication based on external mechanisms on apache 2.4 ap24-mod_perl2-2.0.13,3 Embeds a Perl interpreter in the Apache server apache24-2.4.63 Version 2.4.x of Apache web server apr-1.7.5.1.6.3_4 Apache Portability Library [...] Regression: Apache24 fails to start if mod_perl2 is enabled httpd_error.log: panic: MUTEX_LOCK (22) [Magic.xs:525] during global destruction. revert to perl5-5.36.3_2 not possible any more. running "pkg upgrade -f" to catch missing revision bumps. Apache24 still fails to start
Searching for the panic message gets me to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=977810;msg=2 (with Perl 5.36) https://stackoverflow.com/questions/4902718/detecting-global-destruction-in-perl (with Perl 5.14) https://github.com/Perl/perl5/issues/9698 (with Perl 5.10) So, I don't think this is a 5.40 problem.
I rebuild all Packages with: DEFAULT_VERSIONS+=perl5=5.38 pkg updated 377+ packages. resulting: perl5-5.38.4_1 Practical Extraction and Report Language apache24 starts now, mod_perl2 application is working again. Summary: mod_perl2 does no longer work with perl5-5.40.2_2 mod_perl2 does still work with perl5-5.38.4_1 In the changelog at https://perldoc.perl.org/perl5400delta I see no relevant changes to "global destruction". I am not sure what has ben changed in the behavior. And if there is any workaround or patch needed for 5.40.*
I can reproduce it with the official package set: Empty Jail: # pkg install ap24-mod_perl2 # pkg install otrs # cat > /usr/local/etc/apache24/Includes/perl.conf << 'EOD' LoadModule perl_module libexec/apache24/mod_perl.so PerlRequire /usr/local/otrs/scripts/apache2-perl-startup.pl EOD # service apache24 onestart # tail /var/log/httpd-error.log panic: MUTEX_LOCK (22) [Magic.xs:525] during global destruction. PerlRequire was needed to trigger the bug. I disabled modules to track down the problem Finally disabling only one module "DateTime" fixed the startup of apache: The application was not tested. --- /usr/local/otrs/scripts/apache2-perl-startup.pl.orig +++ /usr/local/otrs/scripts/apache2-perl-startup.pl @@ -67,7 +67,7 @@ eval { require Net::DNS }; # Preload DateTime, an expensive external dependency. +# use DateTime (); -use DateTime (); # Preload dependencies that are always used. use Template (); # service apache24 onestart # tail /var/log/httpd-error.log [Fri Jun 06 10:08:24.610090 2025] [mpm_prefork:notice] [pid 18684] AH00163: Apache/2.4.63 (FreeBSD) mod_perl/2.0.13 Perl/v5.40.2 configured -- resuming normal operations [Fri Jun 06 10:08:24.610319 2025] [core:notice] [pid 18684] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'