[Lazarus] How many timers available on Linux (Raspberry Pi)?

Bo Berglund bo.berglund at gmail.com
Wed Jul 22 00:35:18 CEST 2020


I have ported a Delphi service application from Windows to a console
application on Linux.
I am using Lazarus 2.0.8/Fpc 3.0.4 on Raspbian Buster on an RPi4B.

Today I finally could start it the first time and it immediately threw
an exception with this printed to the console:

pi at rpi4-gui:~/projects/SSRemoteServer/source $ ./SSRemoteServerLx 
[FORMS.PP] ExceptionOccurred 
  Sender=EOutOfResources
  Exception=No timers available
  Stack trace:
  $0025DB18  TCUSTOMTIMER__UPDATETIMER,  line 131 of customtimer.pas
  $0025DC40  TCUSTOMTIMER__SETONTIMER,  line 165 of customtimer.pas
  $00088ABC  TSSREMOTESERVER__CREATE,  line 553 of
class_SSRemoteServer.pas
  $00010B14  CREATEOBJECTS,  line 62 of SSRemoteServerLx.lpr
  $00010CF4  main,  line 114 of SSRemoteServerLx.lpr
Exception at 0025DB18: EOutOfResources:
No timers available.

The exception happens at the very start of the application when
creating the objects which will run the show.
Line 553 of the unit where the problem occurs is marked below with =>

Up until then 3 timers have been successfully created and then the
exception happens when the 4th timer gets its OnTimer event defined...
"No timers available." indicates a possible limit to the number of
timers????

So now I wonder if there is a limit on the number of timers available
on Linux (since this works on Windows)???

Code section where exception happens:

constructor TSSRemoteServer.Create(AOwner: TObject);
begin
  FOwner := AOwner;
  FSSConnection := TSSConnection.Create;
  FSSConnection.OnMessage := OnSSMessage;
  FSSConnection.OnRemoteReadingDone := OnRemoteReadingDone;
  FSSConnection.OnContactResTestDone := OnContactResTestDone;

  FCurrentCmdFile := TSSCommandFile.Create;
  FCurrentMeasureFile := TSSMeasureFile.Create;

  FTasks := TObjectList.Create;  {List of scheduled tasks}
  FTasks.OwnsObjects := true;

  FNormalUsers := TStringList.Create;

  FTimExecute := TTimer.Create(NIL);
  FTimExecute.Enabled := false;
  FTimExecute.Interval := 250;  {Just the start delay}
  FTimExecute.OnTimer := OnExecuteTimer;

  FTimSchedule := TTimer.Create(NIL);
  FTimSchedule.Enabled := false;
  FTimSchedule.Interval := 1000;  {Should be configurable...}
  FTimSchedule.OnTimer := OnScheduleTimer;

  FTimWaitForMeasure := TTimer.Create(NIL);
  FTimWaitForMeasure.Enabled := false;
  FTimWaitForMeasure.Interval := 150;  {Should be configurable...}
  FTimWaitForMeasure.OnTimer := OnWaitForMeasureTimer;

  FTimCmdQueue := TTimer.Create(NIL);
  FTimCmdQueue.Interval := 35;
=>FTimCmdQueue.OnTimer := OnCmdQueueTimer;
  FTimCmdQueue.Enabled := true;


-- 
Bo Berglund
Developer in Sweden



More information about the lazarus mailing list