After migration from v9.4.3 to v10.0.2, SDAC raises error 'Not enough timers available' in thread

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
createmark
Posts: 11
Joined: Wed 01 Jun 2011 07:54

After migration from v9.4.3 to v10.0.2, SDAC raises error 'Not enough timers available' in thread

Post by createmark » Mon 24 Jan 2022 11:22

Hi!

To reproduce it place on form
MSConnection
MSQuery

Set MSQuery1.Options.NonBocking := True
Set MSQuery1.SQL.Text any SELECT query

Add code below in button on click and execute the code

TThread.CreateAnonymousThread(
procedure
begin
CoInitialize(nil);
try
MSQuery1.Close;
MSQuery1.Open;
finally
CoUninitialize;
end;
end).Start;

set debug point on MSQuery1.Close and run (F9) in debug mode, on first executing (click button) this code it's ok but on second executing (click button) you will see error 'Not enough timers available' on line 'MSQuery1.Close'.

This problem happened in CRTimer unit in code

procedure TCRTimer.UpdateTimer;
begin
KillTimer(FWindowHandle, 1);
if (FInterval <> 0) and FEnabled and Assigned(FOnTimer) then
if SetTimer(FWindowHandle, 1, FInterval, nil) = 0 then
raise EOutOfResources.Create(SNoTimers);
end;

What was changed in SDAC that components brings this error and how to fix it? Also, as I understand that NonBocking options is used especially for threads but now looks like NonBocking := false works good.

Thank you.

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: After migration from v9.4.3 to v10.0.2, SDAC raises error 'Not enough timers available' in thread

Post by Stellar » Mon 31 Jan 2022 12:57

Hi there,

Thank you for contacting Devart!

When the NonBocking option is enabled, row fetching is performed on a separate thread.
Since your entire request is executed in a separate thread, you do not need to use NonBocking mode.

More details about NonBocking mode here:
https://docs.devart.com/sdac/devart.sda ... ocking.htm

Let us know if you have any other questions!

createmark
Posts: 11
Joined: Wed 01 Jun 2011 07:54

Re: After migration from v9.4.3 to v10.0.2, SDAC raises error 'Not enough timers available' in thread

Post by createmark » Tue 01 Feb 2022 18:47

Thank you! Yes, NonBlocking := False works well.

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: After migration from v9.4.3 to v10.0.2, SDAC raises error 'Not enough timers available' in thread

Post by Stellar » Wed 02 Feb 2022 13:30

Hi,

Thank you for your reply! I was happy to assist you!
In case you have any further questions about our products, please feel free to contact us any time!

Best regards,
Sergey

Post Reply