[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] multithreading problem
- To: libevent-users@xxxxxxxx
- Subject: [Libevent-users] multithreading problem
- From: Björn K. <bjoernk2@xxxxxxxxxxxxxx>
- Date: Sun, 16 Dec 2012 16:52:13 +0100
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Sun, 16 Dec 2012 10:52:17 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=bDFFNTzOB4TRYcpFgGi8bQ5xUFG/tcU+Uzw6h/HvaKU=; b=EAAsjTiYKxGy9c76Cex3cONb7h6fHYNg51hMeM5trjE5WyEzAr+t0b5WYILk+SFI56 lXV3Jfv69mQKYakRi5buzW+rcFX+FgLHYRxJ28UhZbPHztR8gExOwbW8SFY8T8SgVsLD fKMnrzcGjOHlKqXeiBcV1t8VzdjCTHuo9tC0l0pixKp/CMEwAxt3u+oQ7VYOErxCsNTU LUJleIJkOHMytwa0uwe4r4hQfLG9cHuK8etVLY1jigfLE3PcorAeJXWDRzPxF9TtT2Yk ERq3BwqJQdT6aVJ+m20khRpc9D/E1oScWxEJjrs9H/ugUHBF9r3v9gDprAj0co6i1/5G 5q0Q==
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
Hello,
I'm trying to write a simple https server which utilizes multiple cpu cores.
I call evthread_use_pthreads() and create several pthreads. My
acceptcb and the thread worker functions are below.
For some simple test cases it works. If I use a tool like apache ab
for a perfomance test, I get some weird problems. Running the server
on OS X 10.8.2 the system becomes unresponsive. I can scroll in open
windows, but opening new windows or killing the server isn't possible.
Testing it on an actual Debian Linux with gdb shows a "glibc detected
corrupted double-linked list" error and the server receives a SIGSEGV.
I tried 2.1.1 alpha and 2.1.2 alpha. (I need the 2.1 branch because of
the new EVLOOP_NO_EXIT_ON_EMPTY.)
Thanks,
Björn
=====
Code
=====
static void acceptcb(struct evconnlistener *listener, int sock, struct
sockaddr *sa, int sa_len, void *arg) {
struct bufferevent *bev;
SSL_CTX *server_ctx;
SSL *client_ctx;
server_ctx = (SSL_CTX *)arg;
client_ctx = SSL_new(server_ctx);
bev = bufferevent_openssl_socket_new(thread_base[nextFree(threads)],
sock, client_ctx,
BUFFEREVENT_SSL_ACCEPTING,
BEV_OPT_CLOSE_ON_FREE|BEV_OPT_THREADSAFE);
bufferevent_setcb(bev, readcb, NULL, NULL, NULL);
bufferevent_enable(bev, EV_READ);
}
static void *worker(void *ptr) {
struct event_base **evbase = (struct event_base **)ptr;
*evbase = event_base_new();
event_base_loop(*evbase, EVLOOP_NO_EXIT_ON_EMPTY);
pthread_exit(NULL);
}
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.