<div dir="ltr"><div><div><div>Hi, Just wondering if anyone has any ideas.<br></div>I am using FPC 3.0 by the way.<br><br></div>Anyway,
I am using a third party SFTP server lib and it creates a thread
inherited from tthread and in the create event of the tthread descendant
it does this:<br></div><div>(It uses this thread to read and write data on the socket)<br></div><div><br>FDataAvailable := TEvent.Create(nil, True, False, ''); //tevent maps to teventobject<br><br>{$IFDEF MSWINDOWS}<br> lasterr:=GetLastError;<br> if (lasterr <> 0) then<br> begin<br> msg:=SysErrorMessage(lasterr);<br> SetLastError(NO_ERROR); //<--I added this an attempt to recover from the error<br> raise Exception.Create(<wbr>SCannotCreateEvent+':'+msg);<br> end; <br>{$ENDIF} <br><br><br></div><div>after
the call to FDataAvailable it always has a handle pointer, but what
seems very random like GetLastError will return non 0 always with code
161 which is invalid path name.<br></div><div>When this occurs all new connections will fail, the process becomes useless and I have stop it.<br><br></div><div>If
I remove the call to getlasterror and ignore it, the threads go into
100% cpu usage in the while loops used to read or write when the error
does occur.<br><br></div><div>Users can actually connect but not transfer any data.<br><br></div><div>Also
when I compile as 64bit the odds of this happening go way down and I
can sometimes transfer 10000 files before it happens, on 32bit it
happens much more frequently.<br><br></div><div>Apparently this is only a issue on Windows hence the compiler defs for MSWINDOWS.<br><br></div><div>I did report this issue to the vendor and they said they are looking into it but that could take months.<br><br></div><div>Anyone
have any ideas one why teventobject.create is failing? Even though it
does have a hander pointer is it possible it's somehow a bad pointer?<br><br></div><div>This happens on windows 7 through 10 and even on PCs with lots of resources(32gb ram, SSD hard drive and no corporate bloatware.<br><br></div><div>Thanks,<br><br></div>T</div>