New MWI stasis subscription on SIP reregister

After some days of running my Asterisk 13.32.0 server I start getting messages like; "The ‘stasis/pool’ task processor queue reached 500 scheduled tasks again.".
The system then also become terribly slow, so it seems that indeed the system overloaded.
I then reboot it, and the issue goes away for some days.

I’ve analysed the issue and noticed that the problem seems to be the amount of stasis subscriptions created for MWI.
Our test system has about 50 phones connected running over “chan_sip” and during the tests had no calls whatsoever, just registers and subscribes by SIP devices. (and we use “app_voicemail”)
All taskprocessors seems normal at the start (about 107), but after some time the number keeps increasing and this is due the excessive amounts of MWI subscriptions that are shown.

pbx*CLI> core show taskprocessors
Processor                                                               Processed   In Queue  Max Depth  Low water High water
stasis/p:mwi:all/404@voice-00-00000066                                         18          0          1        450        500
stasis/p:mwi:all/404@voice-00-00000067                                         17          0          1        450        500
stasis/p:mwi:all/404@voice-00-00000068                                         16          0          1        450        500
stasis/p:mwi:all/404@voice-00-00000069                                         15          0          1        450        500
stasis/p:mwi:all/404@voice-00-0000006a                                         14          0          1        450        500
stasis/p:mwi:all/404@voice-00-0000006b                                         13          0          1        450        500
stasis/p:mwi:all/404@voice-00-0000006c                                         12          0          1        450        500
stasis/p:mwi:all/404@voice-00-0000006d                                         11          0          1        450        500
stasis/p:mwi:all/404@voice-00-0000006e                                         10          0          1        450        500
stasis/p:mwi:all/404@voice-00-0000006f                                           9          0          1        450        500
stasis/p:mwi:all/404@voice-00-00000070                                          8          0          1        450        500
stasis/p:mwi:all/404@voice-00-00000071                                          7          0          1        450        500
stasis/p:mwi:all/404@voice-00-00000072                                          6          0          1        450        500
stasis/p:mwi:all/404@voice-00-00000073                                          5          0          1        450        500
stasis/p:mwi:all/404@voice-00-00000074                                          4          0          1        450        500
stasis/p:mwi:all/404@voice-00-00000075                                          3          0          1        450        500
stasis/p:mwi:all/404@voice-00-00000076                                          2          0          1        450        500
stasis/p:mwi:all/404@voice-00-00000077                                          1          0          1        450        500

Note: this is a filtered view, it only shows the MWI subscription of peer 404.

Every 10 minutes (when the phone re-registers) a new MWI subscription is added to the list!
I would expect that the old subscription would be replaced/deleted, but that doesn’t seem to happen.

So, why is this happening?
And could this indeed be the cause of my system slowing down?

It has been awhile since I last posted anything, but I need some help now to understand whether I’m doing something wrong here or if I’m experiencing a bug.

I’ve did some more testing on this issue and found that my overload of Stasis task processors is indeed caused by the message waiting subscriptions on the chan_sip channel.
I used to have over 20000 task processors after Asterisk ran for about 5 days.
But since I disabled the MWI subscription on all phones connected to the system, I now only have about 170 task processors and the system runs smoothly.

The problem appears to be that ; Each MWI subscription via chan_sip is added instead of replace in the Stasis task list.
I’ll attempt to fix the issue and then submit the patch.

I discovered that in chan_sip we “call” the Stasis function stasis_subscribe_pool(mailbox_specific_topic, mwi_event_cb, peer) on every SIP SUBSCRIBE for that mailbox.
And within the Stasis code I read that we need to first unsubscribe before re-subscribing.
So what I did was call the Stasis function stasis_unsubscribe_and_join(mailbox->event_sub) before running the subscribe code.
I tested it and it worked perfectly.

However I’m not sure if this approach is the correct one.
Perhaps someone cares to comment?
patch-chan_sip.diff.txt (701 Bytes)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.