<p>Am 14.10.2016 17:45 schrieb "Snorkl e" <<a href="mailto:tony.caduto@gmail.com">tony.caduto@gmail.com</a>>:<br>
><br>
> Hi, actually getlasterror only applies to the calling thread, getlastOSerror is the one not to use.</p>
<p>GetLastOSError merely calls GetLastError on Windows...</p>
<p>> Anyway I think I found the solution.<br>
> Just for kicks I put in a name with a / I.e /test_name and getlasterror came back with the same error. So the API is being called somewhere with teventobject.create, anyway instead of leaving name blank I put a giud in for the name and low and behold the error stopped. It appears there is a limit or a bug on creating unnamed events from a single process. When you leave name blank the os must be creating a unique name somehow and it has some issue with a lot of them being created and destroyed. When I compiled as 64bit it took much longer for the error to happen. After I used the guid for the event name I stress tested the server with 10s of thousands of connection and disconnecting and that error never happened again.<br>
><br>
> So windows limit or bug? Or could it be a bug in FPC?</p>
<p>Do you destroy the event again once it's no longer used? Of course if you require the events the whole time it might indeed be a Windows limitation.</p>
<p>Regards,<br>
Sven</p>