Jump to content

Recommended Posts

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 by Alexander Pustotin

Share this post


Link to post

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
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

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
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
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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×