[OTR-dev] libotr: crash when generating privkey in another thread

Ian Goldberg ian at cypherpunks.ca
Mon Dec 16 21:19:31 EST 2013


On Tue, Dec 17, 2013 at 01:36:52AM +0100, Martin Milata wrote:
> Hi!
> 
> I'm writing a program that uses libotr-4.0.0 and encountered a problem
> when trying to perform key generation in backtround thread.
> 
> When the key generation is running and another OTR query is received by
> libotr the program crashes with following stacktrace:
> 
> ath.c:193: _gcry_ath_mutex_lock: Assertion `*lock == ((ath_mutex_t) 0)' failed.

What's supposed to happen is when you try to generate the key for the
same account the second time, otrl_privkey_generate_start will return
gcry_error(GPG_ERR_EEXIST), and *newkeyp is set to NULL.  Are you
checking for this?  The second OTR query should not cause a launch of a
background thread at all.

Or do you mean you received OTR Query messages for two _different_ local
accounts?


But more generally, libotr has no way of knowing what threading library
your application is using, so your application may well need to call the
gcry_control to enable multithreading.  Does the problem go away if you
do that before calling OTRL_INIT?

   - Ian



More information about the OTR-dev mailing list