Closed luebbe closed 2 years ago
Additional information. I completely missed that LoggerPro uses a critical section, but the Eurekalog call stack shows an EMonitorLockException.
I also asked in the English Delphi Praxis and Stefan Glienke pointed this out here: https://en.delphipraxis.net/topic/7006-emonitorlockexception-help-needed/
The Eurekalog call stack makes zero sense compared to the code on github. Either you are using some outdated code or modified something yourself. There is nothing monitor in TThreadSafeQueue.Enqueue. It is using a critical section
So it may be a totally different problem and the Eurekalog stack is wrong. We're still running an old (6.x) version of Eurekalog.
So, I think we should put this on hold
Hi Daniele,
After receiving an Eurekalog crash report from a customer, I tried to analyse the problem. I could not reproduce it on my PC yet and it seems to occur randomly on the customer's computer, so it looks like a typical race condition. Here are the relevant lines of the Eurekalog report:
We have the following scenario: The main thread starts a background task (IFuture), which builds up an index of files for later use. Both, main and background task log their status with LoggerPro. If the main task needs the index, it calls the following routine:
Log.Enter and Log.Exit are just two wrapper functions around Log.Debug that I have added to LoggerPro. The Exception occured on the
Log.Exit
callNormally the task takes some time, so the typical log output is:
This is the log output when there is "nothing" to do:
Note that the updater was finished (stLoaded) before WaitForCompletion was called.
This is the LoggerPro output matching the bug report. The
EMonitorLockException
occured on theLog.Exit
call inTUpdater.WaitForCompletion
and this line is missing from the log:Note that the updater was still working (on nothing ;-)) when WaitForCompletion was called, but it probably all happend in the same millisecond, so I assume that thread 3312 still held the lock, when exception thread 20620 called
Log.Exit
.Is there something we are doing wrong or have we come across a race condition in LoggerPro?