Hi,
I am using a third party library that uses TEventObject, and after about a month, it started failing with:
Cannot create event: Error Code 161, Error MSG:The specified path is invalid.
The actual code where this error is raised is:
FDataAvailable := TEventObject.Create(nil, True, False, '');
{$IFDEF MSWINDOWS}
lasterrorcode:=GetLastError;
if lasterrorcode <> 0 then
raise Exception.Create(format('%s: Error Code %d, Error MSG:%s',[SCannotCreateEvent,lasterrorcode,SysErrorMessage(lasterrorcode)]));
{$ENDIF}
I don't want to say what third party lib this is, but it is a SSH server and the event is being created for "data Available" in a thread
The lib code does free FDataAvailable, but if you look in the lazarus code the destructor is virtual and does not do anything, so I am not sure if the handle itself is being closed.
The memory on this process stays stable, so I am guessing handles are not being closed somewhere and when we restarted it after this error occurred the events started being created again, so it would seem the process ran out of handles.
Anyone have any ideas? Is there a way to monitor how many handles a process is creating?