[fpc-pascal] teventobject.create fails with error 161

Sven Barth pascaldragon at googlemail.com
Fri Oct 14 19:26:51 CEST 2016


Am 14.10.2016 17:45 schrieb "Snorkl e" <tony.caduto at gmail.com>:
>
> Hi, actually getlasterror only applies to the calling thread,
getlastOSerror is the one not to use.

GetLastOSError merely calls GetLastError on Windows...

> Anyway I think I found the solution.
> 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.
>
> So windows limit or bug? Or could it be a bug in  FPC?

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.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20161014/c3753864/attachment.html>


More information about the fpc-pascal mailing list