Alexander Pustotin 0 Posted March 1, 2019 (edited) Hi all when switching to Delphi 10.3 Rio I encountered AV in the Parallel Library code. The following somple case can reproduce the issue. I assume that the reason of the problem is a race condition. So it happens in the most of cases but not 100%. program ParallelForAV; {$APPTYPE CONSOLE} uses System.SysUtils, System.Threading; begin try TParallel.&For(1, 200, procedure (AIndex: Integer) begin Abort; end); except { ignore exceptions } end; end. I cannot find this issue at https://quality.embarcadero.com. Could someone confirm the problem? Best regards Alexander Edited March 1, 2019 by Alexander Pustotin Share this post Link to post
Leif Uneus 43 Posted March 1, 2019 Not exactly the same, but https://quality.embarcadero.com/browse/RSP-23466 shows that the threading library in Rio is defect. Share this post Link to post
Günther Schoch 61 Posted March 1, 2019 13 minutes ago, Leif Uneus said: Not exactly the same, but https://quality.embarcadero.com/browse/RSP-23466 @Alexander: I would suggest to use the attached threading.pas (see RSP-23466) to quickly crosscheck if 10.3.x has introduced that problem (as the other ones mentioned in RSP-23466) Share this post Link to post
Sherlock 663 Posted March 1, 2019 There are actually not that many changes in System.Threading.pas. But due to the lack of comments in the code (I hate that) and knowledge in my head (I hate that too) I can't discern which of these changes are bad. On the other hand I'm pretty sure we have a couple of bright guys here, that can find the issue pretty darn fast. Share this post Link to post
Alexander Pustotin 0 Posted March 1, 2019 4 hours ago, Günther Schoch said: @Alexander: I would suggest to use the attached threading.pas (see RSP-23466) to quickly crosscheck if 10.3.x has introduced that problem (as the other ones mentioned in RSP-23466) @Günther: I tried to use the unit attached to https://quality.embarcadero.com/browse/RSP-23466 and still get the AV. I noticed only that the AV can be reproduced rarely rather with original one. Share this post Link to post
Alexander Pustotin 0 Posted March 1, 2019 Just for information: The issue https://quality.embarcadero.com/browse/RSP-23874 was raised for the problem. Share this post Link to post
Stefan Glienke 2002 Posted March 1, 2019 Looks to me very much like a timing problem on shutdown. As soon as I debug or cause some slight delay before the end the AV disappears. Share this post Link to post
Alexander Pustotin 0 Posted March 1, 2019 7 minutes ago, Stefan Glienke said: Looks to me very much like a timing problem on shutdown. As soon as I debug or cause some slight delay before the end the AV disappears. @Stefan: at first sight it looks that TThreadPool doesn't wait for all tasks complete but only already started. Maybe I'm wrong but getting details is too time consuming process :). Share this post Link to post
Stefan Glienke 2002 Posted March 1, 2019 1 hour ago, Alexander Pustotin said: getting details is too time consuming process And not your job but Embarcadero's :) Share this post Link to post
Günther Schoch 61 Posted March 2, 2019 Looks as A. https://quality.embarcadero.com/browse/RSP-16932 Parallel ITasks do not start as expected (solved in 10.3) has caused (based on the feedback of EMBT) B. https://quality.embarcadero.com/browse/RSP-23466 Slow Multi-Thread Code Generation but C. https://quality.embarcadero.com/browse/RSP-23874 AV on finalizing TThreadPool was introduced independently somewhere between 10.0 and 10.3 We really hope the Embarcadero does try to cleanup this issues soon (10.3.2) Share this post Link to post