> -----Original Message-----
> From: owner-openssl-us...@openssl.org [mailto:owner-openssl-
> us...@openssl.org] On Behalf Of Dr. Stephen Henson
> Sent: Wednesday, January 15, 2014 1:56 AM
> To: openssl-users@openssl.org
> Subject: Re: Deadlock in openssl1.0.1e.
> 
> On Tue, Jan 14, 2014, Tayade, Nilesh wrote:
> 
> > Hi,
> >
> > I am not able to understand what???s going wrong, below is the latest
> stack trace I got. Thread 19 is killed by a watchdog, and it was waiting on a
> lock.
> > Other threads do not show any lock being held.
> >
> >
> 
> I'd suggest you modify your locking callback to store the location (file, line
> number) for the lock in question (18 which is CRYPTO_LOCK_RAND) when a
> lock is acquired successfully and clear it when the lock is released. Then 
> when
> you get a deadlock you can see the last instance that held (but did not
> release) the lock.
> 
> You could try compiling with LOCK_DEBUG but that will create a *lot* of
> output.


Thanks for your suggestions. I did try capturing the debug information and 
below is how the state of the locks is. The array per lock stores information 
of the owner, file and lock_present i.e. lock is held or not.
I see that the lock # 18 is held but when thread 19 was waiting, it was trying 
for lock # 19. Not sure what's going on.

(gdb) p ssl_locks[18]
$22 = {
   thread_id = 140003803043584,
   file_name = "md_rand.c", '\000' <repeats 30 times>,
   file_name_len = 9,
   line = 384,
   lock_present = 1
}
(gdb) p ssl_locks[19]
$23 = {
   thread_id = 140003803043584,
   file_name = "md_rand.c", '\000' <repeats 30 times>,
   file_name_len = 9,
   line = 389,
   lock_present = 0
}

The mutex buffer looks like this. I am unable to interpret all the fields, any 
pointers on these?
(gdb) p mutex_buf[19]
$15 = {
   __data = {
     __lock = -1770245546,
     __count = 161970406,
     __owner = -794915378,
     __nusers = 890065223,
     __kind = 634752049,
     __spins = 239812167,
     __list = {
       __prev = 0x3cab28a258ddf6a1,
       __next = 0x1b78c957a2cf4cef
     }
   },
   __size = 
"V2|\226\346x\247\t\316\215\236\320GQ\r51\214\325%G>K\016\241\366\335X\242(\253<\357LϢW\311x\033",
 

   __align = 695657599214563926
}

> 
> Steve.
> --
> Dr Stephen N. Henson. OpenSSL project core developer.
> Commercial tech support now available see: http://www.openssl.org

--
Thanks,
Nilesh

 

Reply via email to