Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This fixes GH #18341 getenv() call allocates memory to squirrel safely away the result of that getenv() call. It does this while in a critical section so as to make sure another thread can't interrupt it and destroy it. The problem when using PERL_MEM_LOG is that the allocation of that memory causes a recursive call to getenv() to see how to log that allocation. And it deadlocks trying to enter the critical section. There are various solutions. One is to use or emulate a general semaphore instead of a binary one. This is effectively what PL_lc_numeric_mutex_depth does for another mutex, and the code for that could be used as a template. But given that this is an extreme edge case which requires Perl to be specially compiled to enable this feature which is used only for debugging, I thought it would be sufficient to just make a special case to not try to lock during that recursive call.
- Loading branch information