You are not logged in.
How would TSynLog work, if TSynLogPerThreadMode = ptIdentifiedInOnFile, and
I am scratching my head, because I am occasionally having EIOError with "File access denied" problem. By "occasionally" - I meant - the application (mORMot2 based) will run normally for a couple of hours then it crashes with "File access defined" error.
Any advice? This might not be mORMot2 problem but I am asking just in case folks here may share some insights.
Offline
I guess the first sentence is not finished.
Enable the logs and see where exactly the EIOERror is triggered.
I doubt it comes from TSynLog.
The whole story is here https://en.delphipraxis.net/topic/5092- … violation/
Basically, I had a multi-threaded application (mORMot2), which also uses TSynLog for logging purpose. I have TSynLogPerThreadMode = ptIdentifiedInOnFile
Then, the application after started, would run normal for a couple of hours, then it crashed. By "a couple of hours" - it is really random, sometimes it is 2~3 hours, sometimes more.
The crash is only logged by Windows Event Viewer, as Access Violation, with the fault offset. TSynLog itself didn't log anything. madExcept (if enabled) didn't log anything either. FastMM5 (if enabled) didn't log anything, either.
From the fault offset, I can trace into somewhere in EIOError code.
If I turn off TSynLog completely, then the access violation would be gone, and never happened. Therefore, I suspect it is something related to TSynLog under multi-threaded environment.
Right now, I had to turn of TSynLog and the application seems running all right without any problem.
Last edited by wxinix (2021-05-26 20:43:19)
Offline
TSynLog is use on production on heavily loaded servers since years.
One thing to know is that the log files are locked during process. They should not be opened directly during process.
If you have opened a log file during rotation, it may have troubles doing the renaming for the rotation.
Also what is the log context when it happens?
Offline
Just in case, read @ab's and @mpv's comment there : https://synopse.info/forum/viewtopic.php?id=5793
I have also more than 80 clients with servers in production (on mormot v2 now) and no TSynLog issue since months. I can remember having issue with TSynLog but it was my learning curve that was not completed, and the issue was introduced by me, it was also a bit hard to spot as I am mixing mORMot2 and OmniThreadLibrary.
Offline
Thank you @ab and @flydev
It turns out the problem was caused by a StackOverFlow exception when the software was trying to sort an array in a background thread (spawned by OmniThread Lib). I used EurekaLog (with multi-threading enabled) to figure that out. So it is not mORMot2 or TSynLog problem.
But I do have a question - it seems that TSynLog cannot capture the StackOverFlow exception that happened in a background thread?
Offline
But I do have a question - it seems that TSynLog cannot capture the StackOverFlow exception that happened in a background thread?
This might be due to OTL. Read this sentence about Exception notifications: http://www.omnithreadlibrary.com/book/chap14.html - then you can try to call your ILog.Log() mecanism inside your exception filter.
Offline