Access violation in ThreadQueueAppend
Original Reporter info from Mantis: Wosi
-
Reporter name:
Original Reporter info from Mantis: Wosi
- Reporter name:
Description:
I face random access violations in my 32 bit Windows console application in classes.ThreadQueueAppend. These AVs seem to be uncatchable. They just cause the application to crash.
What am I doing?
I have a generic queue of items that are processed by a defined amount of worker threads. As soon as an item is enqueued a thread starts processing it. When I want to wait until all the items are processed I call the WaitForAll method.
Everything seems to work fine but sometimes the application crashes. My investigations brought me to the attached little test project that crashes in most cases. I can't see the possibility of any race condition here (please tell me if I'm wrong). The same application runs perfectly in Delphi 10 (and much faster by the way). So I think it's a bug in FPC.
The test project sets up a multi threaded queue of UInt64. It's spawning up to seven worker threads checking the Collatz Conjecture for the given number. Ten numbers are enqueued each time until WaitForAll is being called.
That sequence is repeated 100,0000 times. On my machine it can take a couple of minutes. In most cases the application crashes after less than 20,000 cycles.
Mantis conversion info:
- Mantis ID: 31267
- OS: Windows
- OS Build: 7 & 10
- Platform: 32 Bit Exe on 64 Bit platform
- Version: 3.0.0
- Monitored by: » Wosi (Wosi), » Vincent (Vincent Snijders), » @PascalDragon (Sven Barth)