Jump to content
Sign in to follow this  
mattgorringe

FireDAC.Stan.Async amBlocking causing threadlock

Recommended Posts

Hi Can someone take look at this call stack and threadlock that appears to happen very occasionally with our app on one VM.

 

I have not been able to reproduce on a dev machine.

 

image.thumb.png.90b2f7c76e157e5e87217253b006f7af.png

 

We are using amBlocking for the firedac query but getting a call to check synchronize twice where we get a threadlock on second one.

 

This is main thread.

 

Have checked the 22.0 code and no changes this is from v19.0, procedure in FireDAC.Stan.Async:

procedure TFDStanAsyncExecutor.Run

Here is the offending code:

 

                    else if (FMode = amNonBlocking) or not (
                        (rMsg.message >= WM_KEYDOWN) and (rMsg.message <= WM_DEADCHAR) and
                          ((FAsyncDlg = nil) or not FAsyncDlg.IsFormActive) or
                        (rMsg.message >= WM_MOUSEFIRST) and (rMsg.message <= WM_MOUSELAST) and
                          ((FAsyncDlg = nil) or not FAsyncDlg.IsFormMouseMessage(rMsg)) or
                        (rMsg.message >= WM_SYSKEYDOWN) and (rMsg.message <= WM_SYSDEADCHAR)
                       ) then begin
                      TranslateMessage(rMsg);
                      DispatchMessage(rMsg);
                    end;

To fix im proposing to add in this to the above code block so messages can not be processed with amBlocking.

if FMode <> amBlocking then

Anyone else seen this behavior?

 

Now also it could be possible for a threadlock if we were using amNonBlocking from what i can see - that would also be bad.

 

 

 

Share this post


Link to post

Never had deadlock when using amblocking. On the other hand in D11 sometimes amCancelDialog will not work on query. You must change for the connection before and change back after the query is finished.

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
Sign in to follow this  

×