Merged revisions 82867 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r82867 | russell | 2007-09-18 15:56:43 -0500 (Tue, 18 Sep 2007) | 10 lines

Fix a memory leak that can occur on systems under higher load.  The issue is
that when events are appended to the master event queue, they use the number
of active sessions as a use count so it will know when all active sessions
at the time the event happened have consumed it.  However, the handling of
the number of sessions was not properly synchronized, so the use count was
not always correct, causing an event to disappear early, or get stuck in
the event queue for forever.

(closes issue #9238, reported by bweschke, patch from Ivan, modified by me)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82868 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant 2007-09-18 20:59:21 +00:00
parent b33123cf87
commit c3b4322469
1 changed files with 3 additions and 3 deletions

View File

@ -749,9 +749,9 @@ static void destroy_session(struct mansession *s)
{
AST_LIST_LOCK(&sessions);
AST_LIST_REMOVE(&sessions, s, list);
ast_atomic_fetchadd_int(&num_sessions, -1);
AST_LIST_UNLOCK(&sessions);
ast_atomic_fetchadd_int(&num_sessions, -1);
free_session(s);
}
@ -2527,9 +2527,9 @@ static void *session_do(void *data)
s->f = ser->f;
s->sin = ser->requestor;
ast_atomic_fetchadd_int(&num_sessions, 1);
AST_LIST_LOCK(&sessions);
AST_LIST_INSERT_HEAD(&sessions, s, list);
ast_atomic_fetchadd_int(&num_sessions, 1);
AST_LIST_UNLOCK(&sessions);
/* Hook to the tail of the event queue */
s->last_ev = grab_last();
@ -3076,8 +3076,8 @@ static struct ast_str *generic_http_callback(enum output_format format,
s->last_ev = grab_last();
AST_LIST_LOCK(&sessions);
AST_LIST_INSERT_HEAD(&sessions, s, list);
AST_LIST_UNLOCK(&sessions);
ast_atomic_fetchadd_int(&num_sessions, 1);
AST_LIST_UNLOCK(&sessions);
}
ast_mutex_unlock(&s->__lock);