[Asterisk-code-review] chan pjsip: segfault on already disconnected session (asterisk[13])

Alexei Gradinari asteriskteam at digium.com
Wed Oct 19 10:11:23 CDT 2016


Alexei Gradinari has posted comments on this change. ( https://gerrit.asterisk.org/4142 )

Change subject: chan_pjsip: segfault on already disconnected session
......................................................................


Patch Set 1:

> The session_end_completion task is queued up when we are told that
 > the INVITE session is disconnected. At this point in time the
 > INVITE session is still valid and undestroyed. If the INVITE
 > session reference is incremented there then it is guaranteed to
 > remain valid and undestroyed until the session is ended, after
 > which there should be no other tasks.
"should be no other tasks", but could be.
The monitor thread received on_tsx_state_changed
and placed the session_end_completion into serializer. 
The chan_pjsip received AST_CONTROL_CONNECTED_LINE
and placed the update_connected_line_information into serializer.
The task processor popped the session_end_completion and decreased
the counter and destroyed the session.
Then task processor popped update_connected_line_information...
the session was already destroyed.

 > Even with your current change how does incrementing the INVITE
 > session outside of the monitor thread guarantee it? The monitor
 > thread could result in the count going to 0 and destroying, while
 > the thread queueing up answer/indicate/update_connected_line then
 > increments it back to 1 if I'm understanding correctly.
No.
The pjsip_inv_add_ref will fail and the task will not be placed into serializer.

 > Are we queueing up answer/indicate/etc AFTER we have executed the
 > session_end_completion task?
If the session destroyed the pjsip_inv_add_ref will fail and we will not
queueing up.

-- 
To view, visit https://gerrit.asterisk.org/4142
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia2e3e2f75358cdb530252a9ce158af3d5d9fdf33
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-HasComments: No



More information about the asterisk-code-review mailing list