[Home]

Summary:ASTERISK-25449: main/sched: Regression introduced by 5c713fdf18f causes erroneous duplicate RTCP messages; other potential scheduling issues in chan_sip/chan_skinny
Reporter:Matt Jordan (mjordan)Labels:
Date Opened:2015-10-06 07:39:45Date Closed:2015-10-06 08:32:18
Priority:BlockerRegression?
Status:Closed/CompleteComponents:Core/General
Versions:11.20.0 13.6.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:When 5c713fdf18f was committed, it exposed several consumers of the scheduler API that were not abiding by its contract. These consumers viewed a scheduler ID of 0 as being invalid, when it is in fact a valid scheduler ID. This has different affects:
* A scheduled item may be scheduled twice (as in the case of {{res_rtp_asterisk}})
* A valid scheduled item may be viewed as non-existing, causing logic to fire that should not (as in the case of {{chan_sip}})
* A valid scheduled item may be viewed as a failure
Comments:By: Dirk Wendland (kesselklopfer79) 2015-10-26 05:47:21.688-0500

This is Gerald Schnabel writing because JIRA doesn't let me log in with my account even after several password resets. So I'm writing this with the account of my colleague Dirk.

----

Commit 5c713fdf18f _scheduler: Use queue for allocating sched IDs_ (still) breaks chan_sip.c in asterisk 11.20.0!

Some functions that handle REGISTER expiry do not and can not handle scheduler ID 0.

In {{parse_register_contact()}} {{peer->expire}} is set to the scheduler ID (return value of {{ast_sched_add()}}).

scheduler ID 0 is *not* handled in:

* sip_unregister(): {{peer->expire > 0}}
* complete_sip_registered_peer(): {{peer->expire > 0}}
* set_peer_defaults():

Especially set_peer_defaults() breaks REGISTER expiry threads if doing a _sip reload_ when an expiry thread with scheduler ID 0 exists!
If {{peer->expire}} is 0 all expiry fields are set to -1. ("Don't reset expire or port time during reload if we have an active registration").
Peers then regularly get unregistered.

Before _sip reload_:

{noformat}
[Oct 23 10:14:58] DEBUG[23308] sched.c: Asterisk Schedule Dump (4 in Q, 182 Total, 4 Cache, 8 high-water)
[Oct 23 10:14:58] DEBUG[23308] sched.c: =============================================================
[Oct 23 10:14:58] DEBUG[23308] sched.c: |ID    Callback          Data              Time  (sec:ms)   |
[Oct 23 10:14:58] DEBUG[23308] sched.c: +-----+-----------------+-----------------+-----------------+
[Oct 23 10:14:58] DEBUG[23308] sched.c: |0000 | 0x7fb01b3bed94  | 0x336bb58       | 000011 : 574414 |
[Oct 23 10:14:58] DEBUG[23308] sched.c: |0002 | 0x7fb01b3bed94  | 0x3362f08       | 003563 : 231276 |
[Oct 23 10:14:58] DEBUG[23308] sched.c: |0011 | 0x7fb01b3841c1  | 0x7fb03c10b978  | 000017 : 301530 |
[Oct 23 10:14:58] DEBUG[23308] sched.c: |0008 | 0x7fb01b3841c1  | 0x7fb03c198f08  | 003564 : 124105 |
[Oct 23 10:14:58] DEBUG[23308] sched.c: =============================================================
{noformat}

After _sip reload_: REGISTER expiry thread with ID 0000 is duplicated (-> ID 0009), REGISTER expiry thread with ID 0000 regularly unregisters peer:

{noformat}
[Oct 23 10:14:58] DEBUG[23308] sched.c: Asterisk Schedule Dump (5 in Q, 183 Total, 3 Cache, 8 high-water)
[Oct 23 10:14:58] DEBUG[23308] sched.c: =============================================================
[Oct 23 10:14:58] DEBUG[23308] sched.c: |ID    Callback          Data              Time  (sec:ms)   |
[Oct 23 10:14:58] DEBUG[23308] sched.c: +-----+-----------------+-----------------+-----------------+
[Oct 23 10:14:58] DEBUG[23308] sched.c: |0000 | 0x7fb01b3bed94  | 0x336bb58       | 000011 : 573282 |
[Oct 23 10:14:58] DEBUG[23308] sched.c: |0009 | 0x7fb01b3bed94  | 0x336bb58       | 000069 : 999977 |
[Oct 23 10:14:58] DEBUG[23308] sched.c: |0011 | 0x7fb01b3841c1  | 0x7fb03c10b978  | 000017 : 300398 |
[Oct 23 10:14:58] DEBUG[23308] sched.c: |0008 | 0x7fb01b3841c1  | 0x7fb03c198f08  | 003564 : 122973 |
[Oct 23 10:14:58] DEBUG[23308] sched.c: |0002 | 0x7fb01b3bed94  | 0x3362f08       | 003563 : 230144 |
[Oct 23 10:14:58] DEBUG[23308] sched.c: =============================================================
{noformat}


By: Philippe Bolduc (philippebolduc) 2015-10-28 10:20:53.533-0500

Can this bug cause choppy audio in SIP ?

Thanks