DLL Server hangs when TDAConnectionManager is destroyed

Using Delphi 10 Seattle 32-bit with RO/DA
When closing the app using DLL server, it hangs at TDAConnectionManager.Destroy on line fTimer.Free.
I can trace it to procedure TROThreadTimer.Free and see that it goes to the line WaitFor indefinitely.
Any idea why this happens ?

WaitFor won’t work correctly from DLL_PROCESS_DETACH so I can suggest to stop timer in ConnectionManager like:

ConnectionManager.PoolTimeoutSeconds := 0;

after this, you can free ConnectionManager.

Unfortunately, this doesn’t solve the problem which now occurs on the line: ConnectionManager.PoolTimeoutSeconds := 0
fTimer.Free is called in procedure TDAConnectionManager.SetPoolTimeoutSeconds which then goes back to WaitFor.
Any other ideas ?

you can don’t use thread polling at all.
set these properties in design-time or after creating ConnectionManager.

ConnectionManager.PoolingEnabled := False;
ConnectionManager.PoolTimeoutSeconds := 0;

in this case, internal TROThreadTimer won’t be created.

Problem fixed for connection manager but now occurs in destructor TROInMemorySessionManager.Destroy => KillTimer
Why ?
It looks like something is going wrong with timers

I can’t reproduce this issue with simple testcase.
can you create a simple testcase that reproduces this case, pls?

It will be very hard to extract from the whole app. I’ll see what I can do.
Meanwhile, any idea what could cause this behavior with timers ?

destroying of threads inside DLL - this is a reason for such problems.
you can try to test this workaround:
copy implementation of TROThread.WaitFor to TROThreadTimer.WaitFor. it may solve your issue.

Yes, copy implementation of TROThread.WaitFor to TROThreadTimer.WaitFor fixed the problem!
Will it be included in a next update ?

Thanks, logged as bugs://75520

bugs://75520 got closed with status fixed.

yes, it will be in the next beta

WOW! When this patch will be available?

Many thank’s!


#75520 was fixed 4 years ago

edit: you can ignore all messages with ixxxxx issues. it isn’t related to actual issues

1 Like