You are not logged in.
After a half of year of searching of the source of EThreadError what happens only on hi-load production I finally found a reason
Function InitializeCriticalSectionIfNeededAndEnter is not atomic (even if it is inlined), so code
InitializeCriticalSectionIfNeededAndEnter(cs)
try
finally
LeaveCriticalSection(cs) <------ fails here
end;
can fail (very-very rarely) on LeaveCriticalSection
@ab - I consider to remove InitializeCriticalSectionIfNeededAndEnter function from mORMot2 sources, and may be even from mORMot (it not used in any of mORMot unit)
Last edited by mpv (2020-12-17 14:16:02)
Offline
I think you meant to say the function is not thread safe, which it isn't. Luckily it's not used anywhere in the mORMot project so my thumbs up for removing it from stable and mormot2 branch. Nice find!
Offline