-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4384/#review14372
-----------------------------------------------------------


I don't really like the idea of continually sending the same publication in the 
case that we don't get a response. This basically results in us continually 
spamming the same publication state for the last item in the publication queue. 
I think the original logic used here, where a refresh is scheduled if there are 
no messages in the queue, is the way to go here.

I think the proper fix here is to not make schedule_publish_refresh() depend on 
a non-NULL rdata. In sip_outbound_publish_callback(), the 
pjsip_publishc_cbparam structure we are given has an expiration field on it. 
This expiration value is set to the value of the Expires header in the incoming 
200 OK response from the PUBLISH. If the response is not a 200 OK or there was 
no response, then expiration is set to -1. What this means is that rather than 
passing rdata to schedule_publish_refresh(), you should be able to pass 
param->expiration instead.

Then in schedule_publish_refresh remove the part where the Expires header is 
searched for and use the new passed-in expiration parameter in its place if 
expiration != -1. The rest of the logic in that function can remain the same.

- Mark Michelson


On Jan. 29, 2015, 6:52 p.m., Kevin Harwell wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4384/
> -----------------------------------------------------------
> 
> (Updated Jan. 29, 2015, 6:52 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-24635
>     https://issues.asterisk.org/jira/browse/ASTERISK-24635
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> When Asterisk attempts to send SIP outbound publish information and no 
> response is ever received (no 200 okay, 412, 423) the system eventually 
> crashes. A response is never received because the system Asterisk is 
> attempting to send publish information to is not available. The underlying 
> pjsip framework attempts to send publish information. After several attempts 
> it calls back into the Asterisk outbound publish code. At this point if the 
> "client->queue" is empty Asterisk attempts to schedule a refresh which 
> utilizes "rdata" and since no response was received the given "rdata" 
> struture is NULL. Attempting to dereference a NULL object of course results 
> in a crash.
> 
> This patch re-queues the current message that has not received a response yet 
> (has no "rdata"), thus removing the possibility of the queue being empty and 
> having no "rdata" available. Consequently, in this scenario, the publish 
> refresh is not called and the crash is avoided.
> 
> 
> Diffs
> -----
> 
>   branches/13/res/res_pjsip_outbound_publish.c 431402 
> 
> Diff: https://reviewboard.asterisk.org/r/4384/diff/
> 
> 
> Testing
> -------
> 
> First duplicated the problem by attempting to publish to a non existent 
> system (after a bit Asterisk crashed). After applying the patch using the 
> same setup Asterisk no longer crashed. Also ran the current set of outbound 
> publish testsuite tests to make sure those still passed.
> 
> 
> Thanks,
> 
> Kevin Harwell
> 
>

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to