Summary: | ASTERISK-23999: (Memory leak) Realtime peers are never unref | ||||
Reporter: | nicolasom (nicolasom) | Labels: | |||
Date Opened: | 2014-07-07 17:55:10 | Date Closed: | 2014-09-24 14:55:46 | ||
Priority: | Critical | Regression? | |||
Status: | Closed/Complete | Components: | Channels/chan_sip/DatabaseSupport | ||
Versions: | 1.8.28.2 | Frequency of Occurrence | Constant | ||
Related Issues: |
| ||||
Environment: | Attachments: | ( 0) refs_chan_sip.txt | |||
Description: | I have more than 850,000 realtime peers in memory in less than 24 hours.
CLI> sip show objects {noformat}-= Peer objects: 7 static, 851368 realtime, 1 autocreate =-{noformat} In function build_peer, at line 28831, calling to ref_peer that is never unref_peer. {code} 28829 /* Startup regular pokes */ 28830 if (!devstate_only && enablepoke) { 28831 ref_peer(peer, "schedule qualify"); 28832 sip_poke_peer(peer, 0); 28833 } {code} If remove this code, the problem disappears. sip.conf {code} [general] port=5060 bindaddr=0.0.0.0 srvlookup=yes disallow=all allow=g726,alaw,ulaw,g729,speex,ilbc,g722,gsm dtmfmode=rfc2833 rtupdate=yes rtsavesysname=yes allowguest=no alwaysauthreject=yes callerid= allowsubscribe=no use_q850_reason=yes {code} Realtime SIP Settings: {noformat} Realtime Peers: Yes Realtime Regs: No Cache Friends: No Update: Yes Ignore Reg. Expire: No Save sys. name: Yes Auto Clear: 120 (Disabled) {noformat} | ||||
Comments: | By: Rusty Newton (rnewton) 2014-07-09 18:06:06.561-0500 [~nicolasom] Do you want to submit a patch so you can get credit for it? https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process By: nicolasom (nicolasom) 2014-07-10 04:39:15.769-0500 Sorry, I don't know. My patch removes one functionality to work for me. I don't know exactly where is the problem. By: Matt Jordan (mjordan) 2014-07-10 09:01:56.295-0500 That doesn't quite sound like the solution, since removing that ref creates an unsafe situation where a peer may be removed and dereferenced later. Since this is a ref counting problem, please enable REF_DEBUG in menuselect and provide the resulting ref debug log. This should create a refs file in {{/var/log/asterisk}}. By: nicolasom (nicolasom) 2014-07-10 14:27:11.256-0500 ref debug only chan_sip.c steps: 1. run asterisk (only one realtime peer) 2. run UAC (only registration every 60 seconds, no calls) By: nicolasom (nicolasom) 2014-07-10 14:31:36.472-0500 I attached ref debug log. Do you need more? By: ibercom (ibercom) 2014-07-14 12:48:58.475-0500 [~nicolasom]: Once the required information has been provided, you should use the Send Back button to change the bug's status. By: nicolasom (nicolasom) 2014-07-14 12:52:38.174-0500 Ok,Send Back. Thanks ibercom By: Rusty Newton (rnewton) 2014-07-18 16:14:57.426-0500 [~nicolasom] Did you verify that the problem occurs in your test scenario? {quote} steps: 1. run asterisk (only one realtime peer) 2. run UAC (only registration every 60 seconds, no calls) {quote} What steps did you take to verify the issue occurs? By: nicolasom (nicolasom) 2014-07-19 04:34:36.744-0500 Yes, on every registration, the realtime peer objects counter increases. And never decrements. {noformat} CLI> sip show objects -= Peer objects: 0 static, 3482 realtime, 1 autocreate =- {noformat} By: Rusty Newton (rnewton) 2014-07-22 17:36:07.002-0500 [~mjordan] will take a look at the ref debug, assigning to him. By: ibercom (ibercom) 2014-08-12 04:46:35.681-0500 This bug is similar or related to [ASTERISK-22945|https://issues.asterisk.org/jira/browse/ASTERISK-22945]. The conclusion is the same: "In function build_peer, at line 28831, calling to ref_peer that is never unref_peer." {noformat} ref_peer(peer, "schedule qualify"); {noformat} By: Rusty Newton (rnewton) 2014-09-24 11:29:18.845-0500 [~nicolasom] can report back whether the patch from ASTERISK-22945 fixes your issue? By: nicolasom (nicolasom) 2014-09-24 13:28:55.001-0500 Yes, the patch from ASTERISK-22945 works for me. By: Rusty Newton (rnewton) 2014-09-24 14:55:46.478-0500 Closing. Duplicates ASTERISK-22945. |