[fpc-pascal] Re: I need an lNet expert: multiple connections and only one central CallAction() - is this possible?

Bernd prof7bit at googlemail.com
Wed May 30 14:53:05 CEST 2012


2012/5/29 Jonas Maebe <jonas.maebe at elis.ugent.be>:

> It means that you have memory corruption in your program (using objects after freeing them, writing via pointers that have already been freed, writing past end of a memory block allocated to a pointer, etc).

This seems to happen inside the TLEpollEventer (it won't happen when
using the TLSelectEventer), strange things happen sometimes when the
other side (a socks server) sends its reply (8 bytes) and then
immediately disconnects. On the next iteration of the event loop it
will either correctly fire the OnDisconnect event and everything is ok
or (sometimes) it will immediately call OnReceive again a million
times with 0 bytes (this gives me 100% CPU).

No matter what I try when receiving the socks4 error message (either
just do nothing in OnReveive() and hope the disconnect event will fire
on its own in the next iteration (it will almost always) or trying to
fpshutdown() to always enforce this event or fpshutdown() and also
setting Dispose:=true (so it won't be polled again at all) or simply
calling the Disconnect() method, no matter what I do it will sometimes
enter a very strange corrupted state in the next iteration of
CallAction(). Unfortunately I don't know enough about ePoll to know
how to debug this but I doubt ePoll itself is buggy, there must be
something flawed in the way lNet's is using it.



More information about the fpc-pascal mailing list