[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] Crash in my simple multi-threaded evhttp app [code incl.]
On Wed, Jun 27, 2012 at 11:02:04AM -0700, Julian Bui wrote:
> Hi libevent,
>
> Sorry for the recent surge of emails. I am trying to determine the cause
> of a problem in my application while using evhttp. I wrote a toy/dummy
> server (whose code I included) that exhibits the same problem that my real
> application is having.
>
> PROBLEM OVERVIEW:
>
> My application is using ev_http and I set its gencb (handles any request
> that comes in) to a function that just validates that there's a path or
> query. If a path or query exists, the evhttp_request*, path, and query are
> handed off to one thread which processes the request one at a time. This
> thread is calling evhttp_send_reply or evhttp_send_error when done with the
> request.
>
> The problem is that when I hit my server through the browser and hit
> refresh to constantly send it requests, it crashes. In the debugger, I see
> it crashes on the evhttp_send_reply line and the error reads: "exception at
> 0x____ in ____.exe, 0xC0000005: Access violation reading location
> 0xdddddee5" none of the parameters going into this method are NULL.
>
I don't see either evthread_use_pthreads() or
evthread_use_windows_threads() being used before setting up any events.
Try putting that at the top of your main function before anything else
and compile with -levent_threads
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.