perlsegmentation-faultexitxs

Perl script crashes with mremap_chunk(): invalid pointer or segmentation fault after exit 0


I'm running a Perl script where everything appears to execute correctly, but it crashes immediately after calling exit 0;.

Whether I run the script normally or with perl -d, the crash still happens. However, the error messages differ:

mremap_chunk(): invalid pointer

Debug mode (perl -d):

Segmentation fault

The strange part:

What I’ve Tried:

What I’m Looking For:

Any advice on how to narrow this down or fix it safely in production would be really helpful.


Solution

  • Initially, we suspected it was entirely due to Oracle client cleanup logic during Perl's global destruction phase. However, after extensive testing and valgrind analysis, we observed that the crash only occurs on systems running a specific glibc version (2.34-125.el9_5.8), and disappears when we upgraded to glibc-2.34-168 from RHEL 9.6 Beta.