psgi.input->read dies with EAGAIN
Closed this issue · 4 comments
psgi.input is a raw $sock object now and could cause issues in application that does ->read() on it, like:
Unknown error reading input: Resource temporarily unavailable at /Users/clkao/perl5.10/lib/site_perl/5.10.1/Plack/Request/BodyParser.pm line 101, <> line 14.
Note that clkao says this only happens with the first post request with SSH tunnel.
some clarification: the client initiates 3 ajax requests at one go, the first time all 3 requests are fine. from the second time on, the first of the 3 requests fails in the above way.
Me too, me too.
Going from a remote host, POSTing to a Plack (Tatsumaki) app I'm getting this as well.
The solution i can think of is to let Server::AnyEvent read the whole input and save it into a scalar and set psgi.input to a PerlIO referencing to that, or wrap $sock as inline_object or something to wrap read() method to retry. I think former is easier, but for apps that need asynchronous blocking we might able to save the original socket, in like $env->{'plack.server.anyevent.socket'} with some options? I dunno.
This is fixed by PSGI 1.1 upgrade - psgix.input.buffered and Plack::Request's parser updates.