[asterisk-bugs] [JIRA] (ASTERISK-26918) Failed Subscriptions with Expiry=0 Added and not Removed

Leon Wright (JIRA) noreply at issues.asterisk.org
Wed Mar 13 21:12:47 CDT 2019


    [ https://issues.asterisk.org/jira/browse/ASTERISK-26918?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=246561#comment-246561 ] 

Leon Wright commented on ASTERISK-26918:
----------------------------------------

I have come across this issue when I was discussing this [on the forums|https://community.asterisk.org/t/hint-watchers-increment-indefinitely/78923]. I can confirm it exists from 15.6.x, up to and including Asterisk 16.2.0, built from git and bundled pjproject.

I get the same error:
{code}
SUBSCRIBE sip:x.x.x.95:5060 SIP/2.0
Via: SIP/2.0/UDP x.x.x.104:5060;branch=z9hG4bK975514473
From: "Phone-001" <sip:805EC0017273 at somedomain.com.au>;tag=3191372314
To: <sip:6004 at somedomain.com.au>;tag=0de9c0a5-7ffc-4116-9290-4bbac5f96259
Call-ID: 0_2914073161 at x.x.x.104
CSeq: 3 SUBSCRIBE
Contact: <sip:805EC0017273 at x.x.x.104:5060>
Authorization: <redacted>
Accept: application/dialog-info+xml
Max-Forwards: 70
User-Agent: Yealink SIP-T46S 66.83.0.10
Expires: 1800
Event: dialog
Content-Length: 0


SIP/2.0 500 Unhandled by dialog usages
Via: SIP/2.0/UDP x.x.x.104:5060;received=x.x.x.104;branch=z9hG4bK975514473
Call-ID: 0_2914073161 at x.x.x.104
From: "Phone-001" <sip:805EC0017273 at somedomain.com.au>;tag=3191372314
To: <sip:6004 at somedomain.com.au>;tag=0de9c0a5-7ffc-4116-9290-4bbac5f96259
CSeq: 3 SUBSCRIBE
Server: Asterisk PBX 16.2.0
Content-Length:  0
{code}

In production we see a gradual increase memory usage over time, higher in systems that have a lot of subscriptions. Which eventually leads to OOM and a hard lockup. I have worked around this in the interim by setting a custom presence on all endpoints without a device, but I'm assuming memory usage and ever increasing stale subscriptions is undesirable.

{code}
exten => 6004,hint,Custom:NA
{code}

> Failed Subscriptions with Expiry=0 Added and not Removed
> --------------------------------------------------------
>
>                 Key: ASTERISK-26918
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-26918
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_pjsip_pubsub
>    Affects Versions: 13.14.1, 14.3.0, GIT
>            Reporter: Peter Sokolov
>            Assignee: Unassigned
>            Severity: Minor
>
> When there is a hint defined in the dialplan without the endpoint, like for example:
> exten => 20,hint,
> There are two problems:
> 1.
> When the phone tries to subscribe using the following procedure, asterisk returns "500 Unhandled by dialog usages", however the subscription 313439313239363331303239333235-s29drryc0xcm is still added to the list with Expiry=0 and remains there forever:
> {noformat}
> SUBSCRIBE sip:[2a00:x:x:x::3]:5060 SIP/2.0
> v: SIP/2.0/UDP [2a03:x:x:x:x:x:x:2033]:38047;branch=z9hG4bK-xq7t9dpznq15;rport
> f: <sip:14 at mydom.com>;tag=z6o87pp1q1
> t: <sip:20 at mydom.com>;tag=8f19e7a5-7a1c-4ce0-895d-19cfa68434ab;user=phone
> i: 313439313239363331303239333235-s29drryc0xcm
> CSeq: 63 SUBSCRIBE
> Max-Forwards: 70
> User-Agent: snomD315/8.9.3.46
> m: <sip:14@[2a03:x:x:x:x:x:x:2033]:38047;line=9hfshly5>;reg-id=1
> Event: dialog
> Accept: application/dialog-info+xml
> Authorization: Digest username="14",realm="mydom.com",nonce="1491296310/2488784f3804a67ae5a0ef5cf7c2cb98",uri="sip:20 at mydom.com",qop=auth,nc=00000004,cnonce="532c5a80",response="9cf105591e91cd13137587b287eab098",opaque="29538d6c2567dee4",algorithm=MD5
> Expires: 600
> l: 0
> SIP/2.0 500 Unhandled by dialog usages
> v: SIP/2.0/UDP [2a03:x:x:x:x:x:x:2033]:38047;rport=38047;received=2a03:x:x:x:x:x:x:2033;branch=z9hG4bK-xq7t9dpznq15
> i: 313439313239363331303239333235-s29drryc0xcm
> f: <sip:14 at mydom.com>;tag=z6o87pp1q1
> t: <sip:20 at mydom.com>;tag=8f19e7a5-7a1c-4ce0-895d-19cfa68434ab;user=phone
> CSeq: 63 SUBSCRIBE
> Server: asterisk
> l: 0
> {noformat}
> 2.
> When the phone then tries to subscribe using the alternative procedure, asterisk returns "200 OK" and the subscription succeeds. It is added to the list with its correct Expiry, hovever remains there forever even when expiration time is reached:
> {noformat}
> SUBSCRIBE sip:20 at mydom.com SIP/2.0
> v: SIP/2.0/UDP [2a03:x:x:x:x:x:x:2033]:38047;branch=z9hG4bK-5wcx0sygsfyq;rport
> f: <sip:14 at mydom.com>;tag=cjddyojr6y
> t: <sip:20 at mydom.com>;user=phone
> i: 313439313239363732333435353736-l9luhb32s4wh
> CSeq: 65 SUBSCRIBE
> Max-Forwards: 70
> User-Agent: snomD315/8.9.3.46
> m: <sip:14@[2a03:x:x:x:x:x:x:2033]:38047;line=9hfshly5>;reg-id=1
> Event: dialog
> Accept: application/dialog-info+xml
> Authorization: Digest username="14",realm="mydom.com",nonce="1491296723/d5fd7a6aa9318a82a01deb959883dd4d",uri="sip:20 at mydom.com",qop=auth,nc=00000001,cnonce="3ea0d05e",response="f37da1f9b16d2434ea4ed48d896e6232",opaque="4334bf9753276797",algorithm=MD5
> Expires: 600
> l: 0
> SIP/2.0 200 OK
> v: SIP/2.0/UDP [2a03:x:x:x:x:x:x:2033]:38047;rport=38047;received=2a03:x:x:x:x:x:x:2033;branch=z9hG4bK-5wcx0sygsfyq
> i: 313439313239363732333435353736-l9luhb32s4wh
> f: <sip:14 at mydom.com>;tag=cjddyojr6y
> t: <sip:20 at mydom.com>;tag=aa52a882-ebaf-412a-86c5-eaa59906448b;user=phone
> CSeq: 65 SUBSCRIBE
> Expires: 600
> m: <sip:[2a00:x:x:x::3]:5060>
> Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
> k: 100rel, timer, replaces, norefersub
> Server: asterisk
> l: 0
> {noformat}
> I am seeing the list of subscriptions growing all the time by about 500 entries each 24 hours.
> The workaround I could find is to remove these hints from the dialplan. However then the subscription requests fail and the clients start to retry those subscriptions every few seconds increasing asterisk traffic and load. Extension 20 is a valid extension, however it is not a local endpoint. It is diverted to a mobile number through an external trunk. The phones automatically create a subscription as soon as an extension is assigned to a short dial key.
> ASTERISK-26696 has resolved some issues with the subscriptions, however not the two mentioned above which are present in 14.3.0, 14.4.0-rc2.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list