[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] Simple question about multithreading SSL bufferevents.
- To: "libevent-users@xxxxxxxxxxxxx" <libevent-users@xxxxxxxxxxxxx>
- Subject: [Libevent-users] Simple question about multithreading SSL bufferevents.
- From: John <jjchnk-libevent@xxxxxxxxx>
- Date: Tue, 26 Mar 2013 15:32:17 -0700 (PDT)
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Tue, 26 Mar 2013 18:32:21 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1364337137; bh=PiCI7wUl72eEMgoDYSPSIG7/uFrqElaskjfwufNH7x0=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=4YczYSlFND7jIuXemTB+S7BW1AnfWG9stdGmY3OVC6yATmtW3SGpQ5V+9M8OjOZSWcY4uDQ5/1wXFKmF/bOIEGwAQPzkiDitv1RRdglPLpIhXM4QpIAL8NWN+C4gNkiKQ1OAs+/PINSdxWz0dbOGprqGrEcyyqgEYl07CSYm5Lw=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=ORil+TuwqmMjrDIXpRn87U7QAs9BUYPrssyQP1RW7pyUNoTTQ/VYCM3SVIyIztEBispGakzZ6k05nK/04vcMcqdLMCPJJG0dagsAYne1y3Hq2/7XHceBy1xpA+PMjiUpVt+Hakz2mxc8iVZGFG4C8DsNQX27Y3jWf8VYKRtGZYI=;
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
Hello all,
I am having significant issues with (near immediate) deadlock when trying to send data out a single openssl bufferevent from two separate threads. The individual threads themselves send complete messages with each write. This should present no real problem from a synchronization perspective. In fact, the code works flawlessly when using ordinary bufferevents (not ssl bufferevents).
Are there any known issues with writing to a single openssl bufferevent from multiple threads concurrently? Should I have the expectation of this working, presuming my code is written correctly? I believe I have initialized libevent and openssl correctly for multithreaded execution.
Thanks,
-John
More info, for those interested:
My code fails in the same manner on both OSX and Linux. Both are built with multithreaded libevent/openssl support. (Verified at build time, not programatically. What's a good way to test openssl itself to see if it was built thread safe? I have verified openssl is calling my locking routines with a variety of lock indexes and the like)
I am running:
SSL version: OpenSSL 1.0.1c 10 May 2012
Libevent version: 2.0.21-stable
I have done the following:
1. Initialized openssl per Viega/Messier/Chandra, "Network Security with OpenSSL". (Before using any SSL.)
2. Initialized libevent with evthread_use_pthreads() (Before using any libevent- and verified result)
3. Use option BEV_OPT_THREADSAFE on the bufferevents being created.
And the following, none of which should be required, and none of which helped:
1. Used a global mutex surrounding all calls to libevent.
2. called evbuffer_enable_locking() on both evbuffers associated with the bufferevent.
And verified, for sanity:
1. The shared libraries I am loading are the libraries I expect the system to use.
My server is simply openssl acting as server, using some simple genetated certificates.
I would be happy to share my test code- but it is ~300ish lines due to (primarily) openssl and thread initialization.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.