diff options
author | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-28 22:45:04 +0000 |
---|---|---|
committer | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-28 22:45:04 +0000 |
commit | 20b27360eed972d4ead9d993408d062f15550789 (patch) | |
tree | 1a9403ade0d2024f86b43870e63ea0218a4c6163 /third_party | |
parent | 55863dad74d52878cc06a49dc29d6f3d6f4cb95c (diff) | |
download | chromium_src-20b27360eed972d4ead9d993408d062f15550789.zip chromium_src-20b27360eed972d4ead9d993408d062f15550789.tar.gz chromium_src-20b27360eed972d4ead9d993408d062f15550789.tar.bz2 |
Fix intermittent mongoose webserver crash on Windows. Occassionally, a new worker thread will be started, but will have not have a connection to handle because another worker thread grabs it first. If no further connections arrive, the new worker thread will proceed to exit. This will crash when accessing the worker's connection's context, which has never been set.
The fix is to use the context that was given to the worker initially in this case.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6244002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73034 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/mongoose/mongoose.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/third_party/mongoose/mongoose.c b/third_party/mongoose/mongoose.c index 7e2416f..035532a 100644 --- a/third_party/mongoose/mongoose.c +++ b/third_party/mongoose/mongoose.c @@ -4543,12 +4543,12 @@ worker_thread(struct mg_context *ctx) } /* Signal master that we're done with connection and exiting */ - pthread_mutex_lock(&conn.ctx->thr_mutex); - conn.ctx->num_threads--; - conn.ctx->num_idle--; - pthread_cond_signal(&conn.ctx->thr_cond); - assert(conn.ctx->num_threads >= 0); - pthread_mutex_unlock(&conn.ctx->thr_mutex); + pthread_mutex_lock(&ctx->thr_mutex); + ctx->num_threads--; + ctx->num_idle--; + pthread_cond_signal(&ctx->thr_cond); + assert(ctx->num_threads >= 0); + pthread_mutex_unlock(&ctx->thr_mutex); DEBUG_TRACE((DEBUG_MGS_PREFIX "%s: thread %p exiting", __func__, (void *) pthread_self())); |