libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 100% CPU Usage with Keep-Alives


From: Larry Wimble
Subject: [libmicrohttpd] 100% CPU Usage with Keep-Alives
Date: Thu, 18 Mar 2010 14:56:34 -0400
User-agent: Thunderbird 2.0.0.23 (X11/20090817)


Greetings....

I am having a problem in my application which uses libmicrohttpd wherein the CPU usage spikes to 100% after the first request from Firefox and stays there until the connection times out or you close the browser.

I can reproduce this over and over.  I have:

1) Fired up my webserver based on libmicrohttpd
2) Fired up 'top' in another terminal.
3) Checked to see that CPU usage was normal (it is).
4) Made a request using CURL from the command line with no keep-alives.
5) Checked both netstat -an and top to make sure the connection was closed and CPU usage was normal.
6) Made a request from Firefox.
7) CPU Usage for my webserver process immediately spikes to 100% and stays there. 8) netstat -an states there is an established connection (as it should in a keep-alive situation)
9) Wait 60 seconds.  Process is still at 100%
9) Close browser (thus killing the connection). CPU utilization immediately drops back to normal.

I temporarily added a "Connection: close" header to stop this which has been successful, however, since the application here is a web map-tile-server, the use of keep-alives is definitely desired. I thought perhaps I had an errant thread or something, but have now verified that all calls to the callback specified in MHD_ start_daemon exit normally (with MHD_YES). I am using no other threading.

Setup:

Gentoo Linux
libmicrohttpd 0.4.4
gcc 4.3.2
Not using SSL

My start-up code:

MHD_start_daemon(
              MHD_USE_THREAD_PER_CONNECTION, PORT, NULL, NULL,
              &http_request_handler, NULL, MHD_OPTION_END);

Any suggestions?

Larry

Attachment: larry.vcf
Description: Vcard


reply via email to

[Prev in Thread] Current Thread [Next in Thread]