[racket] Problems trying to do non-blocking I/O and a reactor loop

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Aug 3 19:56:09 EDT 2012

I see that you're using `read-bytes-avail!-evt', which has problems in
v5.2.1 that are fixed for v5.3. The problems include triggering a bug
in `sync', which is also fixed for v5.3.

Does a nightly build behave any differently?

At Fri, 3 Aug 2012 19:11:44 -0400, Greg Hendershott wrote:
> Even the distilled code is maybe a wee bit long for here, so I made a gist:
> https://gist.github.com/3252353
> I wanted to try doing non-blocking I/O and a reactor event loop.
> The gist is an excerpt to simplify the problem case. What I left out
> is the fun stuff where Racket could make this less painful, such as
> using continuations or simply generators to avoid
> nested-callback-chain heck. But before the fun stuff, the foundation:
> Under a light load everything works fine. But ApacheBench with -c > 2
> is making it unhappy, as described in the comments.
> Sometimes it will blow through 10,000 reqs at -c 20 with no problem.
> And giving at least 2X better reqs/sec than comparable
> thread-per-connection example. Yay!
> But on most runs it's getting errors with "input port closed".  And
> rarely I will get a channel? from sync when it should only be an
> eof-object? or integer.  And rarely I even get a Racket seg fault.
> Boo!
> So. Probably I'm doing one or more really stupid things?  Any advice
> would be welcome -- thank you!
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.