[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Problem in receiving HTTP Post request




On Feb 6, 2013, at 10:50 PM, Alap Kumar Sinha wrote:
I am facing a problem where a HTTP request does not reach my HTTP server (based on libevent). Following is the scenario.
 
1.      1.  _javascript_ Application -> Posts  HTTP request to Browser
2.      2.   Browser sends the request to the HTTP server based on libevent.
 
In a success scenario, at point 2 when the Browser sends the request I can see the debug logs from libevent. The initial few lines are as mentioned below.
 
But in the case of failure, these logs never come. I am trying identify if the request is lost in Browser or the libevent HTTP server is hung somewhere and not able to get incoming HTTP requests. Please note that before this failure there had been multiple successful requests that were received by the HTTP server.

First check if the request is lost in the way to the server, or in the server. You can use Wireshark, or tcpdump to record traffic to your http server. Then check if your machine got the lost request.


 
Can someone suggest if there is any specific area of code where I can add some more logging to confirm that libevent is free and polling for new requests? And also if you are aware of any possible cause for this.

Make sure that your code does not block, stopping libevent evenloop. Add a log message when request is received, add log message for each interesting action you do with the request, and finally when request is finished and you send a reply. Then check that your request handling code does block, waiting for something.