ACQUIRE_LOCK deadlock with ipe
When GHC is compiled with both profiling and ipe information, we try to acquire the eventlog mutex twice in the same thread.
ghc: internal error: ACQUIRE_LOCK(0x1dc2e7e0) failed (rts/eventlog/EventLog.c:1572): 35
(GHC version 9.9.20231213 for x86_64_unknown_linux)
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
GHC is compiled using --flavour=perf+profiled_ghc+no_dynamic_ghc+ipe+debug_ghc+debug_info
Then we run ghc with both heap profiling and eventlogs enabled: ghc +RTS -hb -l
The lock is initially acquired in postIPE
:
void postIPE(const InfoProvEnt *ipe)
{
ACQUIRE_LOCK(&eventBufMutex);
Then we attempt to acquire it again in flushAllCapsEventsBufs
void flushAllCapsEventsBufs(void)
{
if (!event_log_writer) {
return;
}
ACQUIRE_LOCK(&eventBufMutex);
printAndClearEventBuf(&eventBuf);
RELEASE_LOCK(&eventBufMutex);