diff options
author | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-03 00:33:29 +0000 |
---|---|---|
committer | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-03 00:33:29 +0000 |
commit | 62b36c8867d69e1e5ed9878c3ffba10aa1d56f2e (patch) | |
tree | 738184d24965e945e70afcac6ec9bbdf9bf57bfe /third_party | |
parent | 5fb88938e3210391f8c948f127fd96d9c2979119 (diff) | |
download | chromium_src-62b36c8867d69e1e5ed9878c3ffba10aa1d56f2e.zip chromium_src-62b36c8867d69e1e5ed9878c3ffba10aa1d56f2e.tar.gz chromium_src-62b36c8867d69e1e5ed9878c3ffba10aa1d56f2e.tar.bz2 |
Fix race in chromedriver webserver where a new pending connection is ignored
because the worker thread thinks the incoming queue is empty.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6982051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87739 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/mongoose/README.chromium | 7 | ||||
-rw-r--r-- | third_party/mongoose/mongoose.c | 10 |
2 files changed, 12 insertions, 5 deletions
diff --git a/third_party/mongoose/README.chromium b/third_party/mongoose/README.chromium index 56532b4..e2db77b 100644 --- a/third_party/mongoose/README.chromium +++ b/third_party/mongoose/README.chromium @@ -1,7 +1,9 @@ -Name: mongoose +Name: Mongoose webserver +Short Name: mongoose URL: http://code.google.com/p/mongoose/ LICENSE: MIT Version: 2.8 +Security Critical: no Description: Mongoose is an easy to use web server. It can be embedded into existing @@ -28,4 +30,5 @@ the chrome versoin of webdriver found under the directory: Local modifications: -Do not check for OS_POSIX, instead just check that it is not windows. - +-Handle case where pthread_cond_timedwait times out but the condition predicate +is actually true. diff --git a/third_party/mongoose/mongoose.c b/third_party/mongoose/mongoose.c index 24874e5..26e4077 100644 --- a/third_party/mongoose/mongoose.c +++ b/third_party/mongoose/mongoose.c @@ -4486,9 +4486,13 @@ get_socket(struct mg_context *ctx, struct socket *sp) #endif if (pthread_cond_timedwait(&ctx->empty_cond, &ctx->thr_mutex, &ts) != 0) { - /* Timeout! release the mutex and return */ - (void) pthread_mutex_unlock(&ctx->thr_mutex); - return (FALSE); + // Even if the wait timed out, it is not guaranteed that the condition + // predicate is actually false. + if (ctx->sq_head == ctx->sq_tail) { + /* Timeout! release the mutex and return */ + (void) pthread_mutex_unlock(&ctx->thr_mutex); + return (FALSE); + } } } assert(ctx->sq_head > ctx->sq_tail); |