Summary:ASTERISK-05744: Regitrations do not get removed after a reload
Reporter:opsys (opsys)Labels:
Date Opened:2005-11-30 10:12:05.000-0600Date Closed:2006-01-26 07:45:48.000-0600
Versions:Frequency of
Description:If I have a register staetment in sip.conf as follows
register => user100:password@my.sip.com

and I change it to:

register => user101:password@my.sip.com

when a reload chan_sip.so is isssued It tries to register with both, I will admit the athe first and second registration attemps failed as the box is down and noot reponding.

A sip show registry after the reload show the correct entry (the new one) bt asterisk still tries to register to both.

A stop now and restart did however remove the old entry.

I am not using ARA I am using static file configs. (sip.conf)
Comments:By: opsys (opsys) 2005-11-30 10:16:20.000-0600

Fixed spelling errors!!

By: opsys (opsys) 2005-11-30 10:39:28.000-0600

I also dicovered that removing the entry does not remove it from memory.

It looks like it is cached somehow, and the cache is not refreshed after a reload.

By: Olle Johansson (oej) 2005-12-01 17:30:36.000-0600

Yes, for some reason, the registration call is not cancelled.

By: opsys (opsys) 2005-12-12 13:38:35.000-0600

On Asterisk CVS HEAD 2005-09-14 03:48:21 UTC

It works as expected!!!!

By: Olle Johansson (oej) 2006-01-09 14:43:51.000-0600

That's weird. So something happened after sept 14th? Still needs checking. haven't had time to hunt this any more, just confirmed that the bug exists.

By: Olle Johansson (oej) 2006-01-09 14:44:34.000-0600

Need to test if this bug exists in 1.2.1 as well.

By: Olle Johansson (oej) 2006-01-25 01:56:05.000-0600

Created branch for locating this issue.

Adding debug output, it seems like AST_OBJ_DESTROYALL really does not destroy peers or registry entries, just destroys the list. I see no calls to registry_destroy as I issue a "sip reload"

Either I miss something or this is *really* bad.

By: Olle Johansson (oej) 2006-01-25 13:34:13.000-0600

Created a branch for testing this. Added debug output and realize that we have a problem with both registry and user objects, maybe also peers not being destroyed because the reference counter is not 0. This propably means a potential bad memory leak... We need to fix this. Working on it.

By: Olle Johansson (oej) 2006-01-25 13:55:23.000-0600

It is a chicken and egg problem. In sip_registry_destroy() we will cancel all dialogs connected to the registry object, but each call has a reference to the object, so sip_registry_destroy will not be called if we have a registration process. We can safely destroy the call first, then destroy all objects.

That may fix it for registry objects. Need to check peers and users just to make sure that the proper thing is happening there.

By: Olle Johansson (oej) 2006-01-25 13:58:29.000-0600

Ok, that fixed registry. Interesting experience with ASTOBJs finding that.

By: Olle Johansson (oej) 2006-01-25 14:10:12.000-0600

an 25 21:57:13 DEBUG[29351]: chan_sip.c:13055 sip_do_reload: --------------- SIP reload started
Jan 25 21:57:13 DEBUG[29351]: chan_sip.c:13070 sip_do_reload: Destroying active SIP dialog for registry oej@jarl.webway.se
Jan 25 21:57:13 DEBUG[29351]: chan_sip.c:2306 sip_destroy: Destroying SIP dialog 334ddb0c3c680b2452b387770882c00c@
Really destroying SIP dialog '334ddb0c3c680b2452b387770882c00c@' Method: REGISTER
Jan 25 21:57:13 DEBUG[29351]: chan_sip.c:2150 __sip_destroy: Not destroying object (refcount 1)
Jan 25 21:57:13 DEBUG[29351]: chan_sip.c:2095 sip_registry_destroy: Destroying registry entry for oej@jarl.webway.se
Jan 25 21:57:13 DEBUG[29351]: chan_sip.c:13076 sip_do_reload: --------------- Done destroying registry list
Jan 25 21:57:13 DEBUG[29351]: config.c:596 config_text_file_load: Parsing /etc/asterisk/sip.conf
Jan 25 21:57:13 DEBUG[29351]: chan_sip.c:12674 reload_config: Not destroying object (refcount 1)
Jan 25 21:57:13 DEBUG[29351]: chan_sip.c:12674 reload_config: Not destroying object (refcount 1)
Jan 25 21:57:13 DEBUG[29351]: chan_sip.c:12674 reload_config: Not destroying object (refcount 1)
Jan 25 21:57:13 DEBUG[29351]: config.c:596 config_text_file_load: Parsing /etc/asterisk/sip_notify.conf
Jan 25 21:57:13 DEBUG[29351]: chan_sip.c:13090 sip_do_reload: --------------- SIP reload done

By: Olle Johansson (oej) 2006-01-25 14:11:14.000-0600

The first line, saying "Not destroying object" - is a user. Then comes the registry that now is destroyed. The user not being destroyed worries me.

By: Olle Johansson (oej) 2006-01-26 07:45:30.000-0600

Resolved in 1.2, revision 8710 and trunk, revision 8711.

The user stuff turned out to be a local issue, not a bug :-) Anyway, learnt a lot about ASTOBJ stuff...

Thank you for reporting this!