[Asterisk-code-review] pjsip distributor.c: Fix deadlock with TCP type transports. (asterisk[13])
Richard Mudgett
asteriskteam at digium.com
Fri Jun 30 13:04:06 CDT 2017
Hello Jenkins2, Joshua Colp, Alexei Gradinari,
I'd like you to reexamine a change. Please visit
https://gerrit.asterisk.org/5919
to look at the new patch set (#2).
Change subject: pjsip_distributor.c: Fix deadlock with TCP type transports.
......................................................................
pjsip_distributor.c: Fix deadlock with TCP type transports.
When a SIP message comes in on a transport, pjproject obtains the lock on
the transport and pulls the data out of the socket. Unlike UDP, the TCP
transport does not allow concurrent access. Without concurrency the
transport lock is not released when the transport's message complete
callback is called. The processing continues and eventually Asterisk
starts processing the SIP message. The first thing Asterisk tries to do
is determine the associated dialog of the message to determine the
associated serializer. To get the associated serializer safely requires
us to get the dialog lock.
To send a request or response message for a dialog, pjproject obtains the
dialog lock and then obtains the transport lock. Deadlock can result
because of the opposite order the locks are obtained.
* Fix the deadlock by obtaining the serializer associated with the dialog
another way that doesn't involve obtaining the dialog lock. In this case,
we use an ao2 container to hold the associated endpoint and serializer.
The new locks are held a brief time and won't overlap other existing lock
times.
ASTERISK-27090 #close
Change-Id: I9ed63f4da9649e9db6ed4be29c360968917a89bd
---
M res/res_pjsip/pjsip_distributor.c
1 file changed, 174 insertions(+), 42 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/19/5919/2
--
To view, visit https://gerrit.asterisk.org/5919
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I9ed63f4da9649e9db6ed4be29c360968917a89bd
Gerrit-Change-Number: 5919
Gerrit-PatchSet: 2
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170630/c5eb3140/attachment-0001.html>
More information about the asterisk-code-review
mailing list