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

From: Greg Hendershott (greghendershott at gmail.com)
Date: Fri Aug 3 20:36:13 EDT 2012

Thank you for such a quick reply!

> 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.

Well, I only tried read-bytes-avail!-evt after getting similar errors
with regexp-match-evt.  So if the fix is specific to rba-evt, that's
probably not it.

Also although it was maybe buried in the comments, I had the same
errors with 5.2 as 5.2.1. FWIW.

> Does a nightly build behave any differently?

I'm trying 5.3.0.16 right now. ApacheBench is not eliciting the errors
... so far. Previously it could take awhile before the errors would
start to pop up.  Fingers crossed ...

On Fri, Aug 3, 2012 at 7:56 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> 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.