summaryrefslogtreecommitdiff
path: root/channels/chan_pjsip.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2015-09-10 17:19:26 -0500
committerMark Michelson <mmichelson@digium.com>2015-09-15 13:28:05 -0500
commit0a74c803004c1c7d4d53aecc9e818b63d5a1e9d6 (patch)
tree88a4ddc77f4e08253e8306dd95d99f783be0b662 /channels/chan_pjsip.c
parent6097a1fc058600764c6714f6650c2dc71b46cc21 (diff)
scheduler: Use queue for allocating sched IDs.
It has been observed that on long-running busy systems, a scheduler context can eventually hit INT_MAX for its assigned IDs and end up overflowing into a very low negative number. When this occurs, this can result in odd behaviors, because a negative return is interpreted by callers as being a failure. However, the item actually was successfully scheduled. The result may be that a freed item remains in the scheduler, resulting in a crash at some point in the future. The scheduler can overflow because every time that an item is added to the scheduler, a counter is bumped and that counter's current value is assigned as the new item's ID. This patch introduces a new method for assigning scheduler IDs. Instead of assigning from a counter, a queue of available IDs is maintained. When assigning a new ID, an ID is pulled from the queue. When a scheduler item is released, its ID is pushed back onto the queue. This way, IDs may be reused when they become available, and the growth of ID numbers is directly related to concurrent activity within a scheduler context rather than the uptime of the system. Change-Id: I532708eef8f669d823457d7fefdad9a6078b99b2
Diffstat (limited to 'channels/chan_pjsip.c')
0 files changed, 0 insertions, 0 deletions