[Freeswitch-dev] Possible deadlock in src/switch_event.c ?

Karol Golab karol at tls.pl
Mon Nov 28 11:31:52 MSK 2011


   Hi!

   I've noticed some strange code in src/switch_event.c - could someone 
smarter (& knowing the mentioned code) please take a look?

   The problem is in the order of calls to locks BLOCK & RWLOCK - it 
differs between functions:

switch_event_bind_removable
         switch_mutex_lock(BLOCK);
         switch_thread_rwlock_wrlock(RWLOCK);

switch_event_unbind_callback
     switch_thread_rwlock_wrlock(RWLOCK);
     switch_mutex_lock(BLOCK);

switch_event_unbind
     switch_thread_rwlock_wrlock(RWLOCK);
     switch_mutex_lock(BLOCK);

   As I understand this may lead to an outright deadlock between bind 
and unbind.

   I stumbled upon this code while debugging what seems like deadlocks 
in our test FS installation put under some heavy load. The load is about 
25 new event subscribers per second (destroyed few seconds later) and 
about 700 events per second.

   Regards,
   Karol

-- 

    e-mail: Karol.Golab at tls.pl
       www: http://www.tls.pl
signature: not found

   company: TLS-Technologie Spółka z ograniczoną odpowiedzialnością z siedzibą w Warszawie przy ul. Polnej 50 00-644; KRS 0000073337 (XII Wydział Gospodarczy KRS); NIP 526-25-78-091; VAT ID PL5262578091; REGON 017349442; kap. zak. 50000,00 zł





Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list