[Pkg-voip-commits] [asterisk] 06/10: Add AST-2017-013.patch

tzafrir at debian.org tzafrir at debian.org
Wed Dec 13 20:23:02 UTC 2017


This is an automated email from the git hooks/post-receive script.

tzafrir pushed a commit to branch stretch
in repository asterisk.

commit 87b8d0656a8285973783a7d52cfaf69bfdf73079
Author: Tzafrir Cohen <tzafrir at debian.org>
Date:   Wed Dec 13 18:28:42 2017 +0200

    Add AST-2017-013.patch
---
 debian/patches/AST-2017-013.patch | 70 +++++++++++++++++++++++++++++++++++++++
 debian/patches/series             |  1 +
 2 files changed, 71 insertions(+)

diff --git a/debian/patches/AST-2017-013.patch b/debian/patches/AST-2017-013.patch
new file mode 100644
index 0000000..55010b7
--- /dev/null
+++ b/debian/patches/AST-2017-013.patch
@@ -0,0 +1,70 @@
+From 0cdd31ee1044344b3dccf826f5dd72f46bc804ee Mon Sep 17 00:00:00 2001
+From: George Joseph <gjoseph at digium.com>
+Date: Thu, 30 Nov 2017 13:38:50 -0700
+Subject: [PATCH] AST-2017-013: chan_skinny: Call pthread_detach when sess
+ threads end
+
+chan_skinny creates a new thread for each new session.  In trying
+to be a good cleanup citizen, the threads are joinable and the
+unload_module function does a pthread_cancel() and a pthread_join()
+on any sessions that are active at that time.  This has an
+unintended side effect though. Since you can call pthread_join on a
+thread that's already terminated, pthreads keeps the thread's
+storage around until you explicitly call pthread_join (or
+pthread_detach()).   Since only the module_unload function was
+calling pthread_join, and even then only on the ones active at the
+tme, the storage for every thread/session ever created sticks
+around until asterisk exits.
+
+* A thread can detach itself so the session_destroy() function
+  now calls pthread_detach() just before it frees the session
+  memory allocation.  The module_unload function still takes care
+  of the ones that are still active should the module be unloaded.
+
+ASTERISK-27452
+Reported by: Juan Sacco
+
+Change-Id: I9af7268eba14bf76960566f891320f97b974e6dd
+---
+ channels/chan_skinny.c | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
+index ad7351df3a..ccf6a94641 100644
+--- a/channels/chan_skinny.c
++++ b/channels/chan_skinny.c
+@@ -7429,6 +7429,11 @@ static void destroy_session(struct skinnysession *s)
+ 	}
+ 	ast_mutex_unlock(&s->lock);
+ 	ast_mutex_destroy(&s->lock);
++
++	if (s->t != AST_PTHREADT_NULL) {
++		pthread_detach(s->t);
++	}
++
+ 	ast_free(s);
+ }
+ 
+@@ -7515,11 +7520,6 @@ static void *skinny_session(void *data)
+ 	int eventmessage = 0;
+ 	struct pollfd fds[1];
+ 
+-	if (!s) {
+-		ast_log(LOG_WARNING, "Bad Skinny Session\n");
+-		return 0;
+-	}
+-
+ 	ast_log(LOG_NOTICE, "Starting Skinny session from %s\n", ast_inet_ntoa(s->sin.sin_addr));
+ 
+ 	pthread_cleanup_push(skinny_session_cleanup, s);
+@@ -7685,6 +7685,7 @@ static void *accept_thread(void *ignore)
+ 		s->keepalive_timeout_sched = -1;
+ 
+ 		if (ast_pthread_create(&s->t, NULL, skinny_session, s)) {
++			s->t = AST_PTHREADT_NULL;
+ 			destroy_session(s);
+ 		}
+ 	}
+-- 
+2.11.0
+
diff --git a/debian/patches/series b/debian/patches/series
index 2dea6f8..95446ac 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -54,3 +54,4 @@ AST-2017-008-13.13.diff
 AST-2017-010.patch
 AST-2017-011.patch
 AST-2017-012.patch
+AST-2017-013.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/asterisk.git



More information about the Pkg-voip-commits mailing list