Hi, Just wondering if anyone has any ideas. I am using FPC 3.0 by the way. 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: (It uses this thread to read and write data on the socket)
FDataAvailable := TEvent.Create(nil, True, False, ''); //tevent maps to teventobject {$IFDEF MSWINDOWS} lasterr:=GetLastError; if (lasterr <> 0) then begin msg:=SysErrorMessage(lasterr); SetLastError(NO_ERROR); //<--I added this an attempt to recover from the error raise Exception.Create(SCannotCreateEvent+':'+msg); end; {$ENDIF} 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. When this occurs all new connections will fail, the process becomes useless and I have stop it. 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. Users can actually connect but not transfer any data. 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. Apparently this is only a issue on Windows hence the compiler defs for MSWINDOWS. I did report this issue to the vendor and they said they are looking into it but that could take months. 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? This happens on windows 7 through 10 and even on PCs with lots of resources(32gb ram, SSD hard drive and no corporate bloatware. Thanks, T
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal