Re: pitfall with Perl Event module and socket io events
[email protected] (Joshua N Pritikin) Thu, 25 Aug 2005 20:10:11 +0530
| Newsgroups | perl.loop |
|---|---|
| Message-ID | <[email protected]> |
--p19/OaUkOQckSefz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 25, 2005 at 02:58:04PM +0200, Simon Hardy-Francis wrote: > I've been developing with your Perl Event module and came up again a > pitfall which took me some time to solve... maybe you would like to > consider adding some kind of 'warning' or 'hint' into the Event > documentation? >=20 > The pitfall: I set up an io event in order to read from an open > socket. The io event defaulted to automatically 'repeat' and here lies > the pitfall... Much safer is to set repeat =3D> 0 and then inside the > socket read event re-start the event after the sysread(). Why? > Otherwise very many incoming packets can cause Event to backlog read > events faster than the events are processed... e.g. if one does a > little bit (too much) of processing after the sysread(). For the naive > programmer then the first sign of trouble is the socket read event > through-put simpy l dropping as time goes by. I noticed this same > behavior with the latest version of Event on both Windows XP and > Solaris 10. Manually repeating solves the problem. Dunno, it's hard to change the defaults now. I highly recommend NetServer::ProcessTop for diagnosing this kind of thing. --=20 Make April 15 just another day, visit http://fairtax.org --p19/OaUkOQckSefz Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFDDdhLqcqnlKSmC70RAiwUAJ93XNbSSm/MTQevzCXmn45EWJzMnQCgwE2k snwtE/kBdEsY52OF7jz1S2s= =ngQd -----END PGP SIGNATURE----- --p19/OaUkOQckSefz--