Discussion:
[asio-users] http example3 hang on long request
Bruno Coudoin
2014-03-05 11:20:01 UTC
Permalink
Hi,

I am working on a software who use asio http example3 as a base for its
http server.

I found out that when we process a long request (more than a second) the
http server hang and no more processes any requests.

I tested it against boost 1_55 on Ubuntu 12.04 with the example
libs/asio/example/cpp03/http/server3. Attached is a small patch to
request_handler.cpp that will do a sleep 10s when the url /sleep is
passed to the server.

My test protocol is the following:

- Run asio server:
./asio_server3 0.0.0.0 8080 10 .

- Run an http test tool on an existing file on the serveur path:
openload http://localhost:8080/mime_types.hpp 20

- Trig the sleep
wget http://localhost:8080/sleep

What I observe is that openload is frozen during the sleep. The asio
server cannot event be closed with ctrl-c. Changing the number of worker
thread in the server or in the client as no impact on the issue.

Does anyone can explain this behavior and propose a solution to support
long lasting requests?

Bruno.

Loading...