[Asterisk-code-review] chan sip: Ensure TCP/TLS threads are terminated before unloa... (asterisk[13])
Joshua Colp
asteriskteam at digium.com
Mon Apr 25 14:43:59 CDT 2016
Joshua Colp has uploaded a new change for review.
https://gerrit.asterisk.org/2701
Change subject: chan_sip: Ensure TCP/TLS threads are terminated before unloading.
......................................................................
chan_sip: Ensure TCP/TLS threads are terminated before unloading.
The unload process currently tells each TCP/TLS to terminate but
does not wait for them to do so. This introduces a race condition
where the container holding the threads may be destroyed before
the threads are able to remove themselves from it. When they
finally do the container is invalid and can't be used causing a
crash.
This change waits for all the threads to remove themselves before
continuing the unload process.
ASTERISK-25961 #close
Change-Id: Idc6262b670ca49ede32061159e323b7b63c6f3c6
---
M channels/chan_sip.c
1 file changed, 5 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/01/2701/1
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 45827b4..96b9d2d 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -35272,6 +35272,11 @@
}
ao2_iterator_destroy(&i);
+ /* Wait for the existing TCP/TLS threads to stop */
+ while (ao2_container_count(threadt)) {
+ usleep(1);
+ }
+
/* Hangup all dialogs if they have an owner */
i = ao2_iterator_init(dialogs, 0);
while ((p = ao2_t_iterator_next(&i, "iterate thru dialogs"))) {
--
To view, visit https://gerrit.asterisk.org/2701
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc6262b670ca49ede32061159e323b7b63c6f3c6
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
More information about the asterisk-code-review
mailing list