http-server example seems to hang under ApacheBench
Opened this issue · 1 comments
First off, thanks for mioco!
Steps to reproduce from b8cc872 (macOS 10.12.4, macbook pro with 4 cores):
$ cargo build --example http-server
$ target/debug/examples/http-server&
$ ab http://127.0.0.1:5555/
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)...apr_pollset_poll: The timeout specified has expired (70007)
Total of 1 requests completed
Sending single requests via telnet or Chrome works fine. I think it has to do with not closing the connection here: https://github.com/dpc/mioco/blob/master/examples/http-server.rs#L68
If I add a return Ok(())
there, ab
works intermittently. It hangs every few requests.
I'm guessing: the pipelining is not being handled correctly at all here, and that bench might be using it.
The exact end of the previous request needs to be correctly handled there so that any bytes of new request are being moved to a new request buffer.
Otherwise, the following request will be invalid, and forever looping without goal and meaning.