<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Please post it to <a href="http://jira.freeswitch.org">jira.freeswitch.org</a><div><br></div><div>/b</div><div><br><div><div>On Nov 28, 2011, at 2:31 AM, Karol Golab wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><br> Hi!<br><br> I've noticed some strange code in src/switch_event.c - could someone<span class="Apple-converted-space"> </span><br>smarter (& knowing the mentioned code) please take a look?<br><br> The problem is in the order of calls to locks BLOCK & RWLOCK - it<span class="Apple-converted-space"> </span><br>differs between functions:<br><br>switch_event_bind_removable<br> switch_mutex_lock(BLOCK);<br> switch_thread_rwlock_wrlock(RWLOCK);<br><br>switch_event_unbind_callback<br> switch_thread_rwlock_wrlock(RWLOCK);<br> switch_mutex_lock(BLOCK);<br><br>switch_event_unbind<br> switch_thread_rwlock_wrlock(RWLOCK);<br> switch_mutex_lock(BLOCK);<br><br> As I understand this may lead to an outright deadlock between bind<span class="Apple-converted-space"> </span><br>and unbind.<br><br> I stumbled upon this code while debugging what seems like deadlocks<span class="Apple-converted-space"> </span><br>in our test FS installation put under some heavy load. The load is about<span class="Apple-converted-space"> </span><br>25 new event subscribers per second (destroyed few seconds later) and<span class="Apple-converted-space"> </span><br>about 700 events per second.<br><br> Regards,<br> Karol<br></span></blockquote></div><br></div></body></html>