mhttpd freezes while trying to send/re-sending data

Issue #27 closed
Thomas Lindner created an issue

I'm not sure if these counts as a bug, since I think it is a known problem. But I'm thinking that we can get better behaviour from mhttpd.

Here's the problem:

1) I have two computers talking to a particular mhttpd server. computer A is just periodically checking the MIDAS status page, but computer B is checking some MIDAS custom page which is making data-heavy requests. For instance, we might have some custom page that is periodically grabbing the whole ODB; ie, a request like

http://neut14.triumf.ca:8081/CS/?cmd=jcopy&odb=/&format=json

2) The problem happens if the network connection drops out for computer B after it makes the http request but before the mhttpd server has returned the data. We get a connection timeout for computer B, obviously. But we also find that the status page can no longer be reached by computer A.

3) The diagnosis seems fairly clear: mhttpd gets stuck in a state trying to send the data back to computer B; I can attach to the process with gdb and confirm that that is where mhttpd is stuck.

4) Interestingly mhttpd does recover when the network is reconnected to computer B, even if the connection was disconnected for a couple minutes.

So what I'd like is to have mhttpd::send() timeout after some reasonable amount of time, so that mhttpd doesn't freeze entirely if a particular send fails.

Maybe there are better ways of implementing this; maybe we can get the TCP layer on the server side to timeout instead. Anyway, any solution is fine with me.

This problem was discovered/explained by Amy Roberts and Joel Sander from USD.

Comments (4)

  1. Stefan Ritt

    mhttpd has in meantime switched over to the mongoose server which uses different code for network communication. Can you confirm that the issue is still there with the new mongoose server?

  2. Log in to comment