Hello,
I seem to have run against another strange problem, to me, atleast. I'm using
bufferevents and the evconnlistener interface to set up a new listener on a
base, setting up some options on the base, and dispatching it. I'm then stress
testing this program, at which point the base exits causing everything to fail.
The return code is 1. Does anyone have any idea as to why this might be
happening?
I assume for some reason my evconnlistener is disappearing, which causes the
base to have no more fd's registered, and hence it exits (i.e, I don't think
the base itself is acting weird, I just don't know *why* its exiting the way it
is). When I keep the number of requests/s moderate (under 1000), it doesn't
die, but when I go up to 5,000, it serves all the requests and then dies. The
machine has adequate memory, and there's nothing untoward in dmesg (Linux, not
windows).
Another thing I noticed, again related to base, is the insanely high overhead
of locking on the event base for some reason, I'm not specifically running it
from multiple threads or anything like that, but, after ~1000-2000 connections,
the base just hangs at pthread's lock_wait, whereas with the NOLOCK flag, its
perfectly happy to continue up to 10,000 (although it exits right after).
Should I just put the loop in a while(1)? What should I be checking? Any
specific buffers that might be getting overflown? Anything at all, really?
My application works like so:
I have a listener and an accept callback, I use bufferevents with the
THREADSAFE option set. My read callback does very little processing, it grabs
the data and throws it into a queue like structure, from which multiple threads
remove it. Along with each piece of data, there's the bufferevent associated
with that bit of data, with which we send the data back to the requester,
directly from the thread that does the processing (I assumed this is what the
THREADSAFE option was for, correct me if I'm wrong).
I don't quite get the use of locks on the event loop, as that's most likely
only going to run on one thread?
Thank you!
***********************************************************************
To unsubscribe, send an e-mail to [email protected] with
unsubscribe libevent-users in the body.