Skip to content

Commit

Permalink
Fix proxy launcher error in chromedriver posix when chrome is closed.
Browse files Browse the repository at this point in the history
The proxy launcher couldn't determine chrome's exit code because chromedriver
was ignoring SIGCHLD.
BUG=none
TEST=none


Review URL: http://codereview.chromium.org/8929013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114365 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
kkania@chromium.org committed Dec 14, 2011
1 parent 65e3d28 commit 75c7f90
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
7 changes: 5 additions & 2 deletions third_party/mongoose/README.chromium
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ Name: Mongoose webserver
Short Name: mongoose
URL: http://code.google.com/p/mongoose/
LICENSE: MIT
Version: Revision 55cf8bf30cd9 (between 3.0 and 3.1)
Version: 55cf8bf30cd9
Release: between 3.0 and 3.1
Security Critical: no

Description:
Expand All @@ -20,4 +21,6 @@ the chrome versoin of webdriver found under the directory:
Local modifications (all detailed in chrome-mongoose-modifications.diff,
pending upstreaming by danielwh):
* Fixed a couple of Windows/VS2010 compiler warnings/errors
* Fixed linger code to apply to sockets from bind, rather than shutdown
* Fixed linger code to apply to sockets from bind, rather than shutdown
* Don't ignore SIGCHLD, since the proxy launcher depends on it for determining
chrome's exit code.
23 changes: 16 additions & 7 deletions third_party/mongoose/chrome-mongoose-modifications.diff
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff -r 55cf8bf30cd9 mongoose.c
--- a/mongoose.c Fri Aug 26 21:30:20 2011 +0100
+++ b/mongoose.c Thu Nov 03 02:16:22 2011 +0000
diff --git a/third_party/mongoose/mongoose.c b/third_party/mongoose/mongoose.c
--- a/third_party/mongoose/mongoose.c
+++ b/third_party/mongoose/mongoose.c
@@ -23,7 +23,9 @@
#else
#define _XOPEN_SOURCE 600 // For flockfile() on Linux
Expand Down Expand Up @@ -32,7 +32,7 @@ diff -r 55cf8bf30cd9 mongoose.c
#define NO_CGI // WinCE has no pipes

typedef long off_t;
@@ -849,7 +854,9 @@
@@ -849,7 +854,9 @@ static int pthread_cond_init(pthread_cond_t *cv, const void *unused) {
}

static int pthread_cond_wait(pthread_cond_t *cv, pthread_mutex_t *mutex) {
Expand All @@ -43,7 +43,7 @@ diff -r 55cf8bf30cd9 mongoose.c
ReleaseMutex(*mutex);
WaitForMultipleObjects(2, handles, FALSE, INFINITE);
return WaitForSingleObject(*mutex, INFINITE) == WAIT_OBJECT_0? 0 : -1;
@@ -3424,6 +3431,10 @@
@@ -3424,6 +3431,10 @@ static int set_ports_option(struct mg_context *ctx) {
struct vec vec;
struct socket so, *listener;

Expand All @@ -54,7 +54,7 @@ diff -r 55cf8bf30cd9 mongoose.c
while (success && (list = next_option(list, &vec, NULL)) != NULL) {
if (!parse_port_string(&vec, &so)) {
cry(fc(ctx), "%s: %.*s: invalid port spec. Expecting list of: %s",
@@ -3448,6 +3459,8 @@
@@ -3448,6 +3459,8 @@ static int set_ports_option(struct mg_context *ctx) {
// Thanks to Igor Klopov who suggested the patch.
setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void *) &on,
sizeof(on)) != 0 ||
Expand All @@ -63,7 +63,7 @@ diff -r 55cf8bf30cd9 mongoose.c
bind(sock, &so.lsa.u.sa, so.lsa.len) != 0 ||
listen(sock, 100) != 0) {
closesocket(sock);
@@ -3768,15 +3781,8 @@
@@ -3768,15 +3781,8 @@ static void reset_per_request_attributes(struct mg_connection *conn) {

static void close_socket_gracefully(SOCKET sock) {
char buf[BUFSIZ];
Expand All @@ -79,3 +79,12 @@ diff -r 55cf8bf30cd9 mongoose.c
// Send FIN to the client
(void) shutdown(sock, SHUT_WR);
set_non_blocking_mode(sock);
@@ -4233,8 +4239,6 @@ struct mg_context *mg_start(mg_callback_t user_callback, void *user_data,
// Ignore SIGPIPE signal, so if browser cancels the request, it
// won't kill the whole process.
(void) signal(SIGPIPE, SIG_IGN);
- // Also ignoring SIGCHLD to let the OS to reap zombies properly.
- (void) signal(SIGCHLD, SIG_IGN);
#endif // !_WIN32

(void) pthread_mutex_init(&ctx->mutex, NULL);
2 changes: 0 additions & 2 deletions third_party/mongoose/mongoose.c
Original file line number Diff line number Diff line change
Expand Up @@ -4239,8 +4239,6 @@ struct mg_context *mg_start(mg_callback_t user_callback, void *user_data,
// Ignore SIGPIPE signal, so if browser cancels the request, it
// won't kill the whole process.
(void) signal(SIGPIPE, SIG_IGN);
// Also ignoring SIGCHLD to let the OS to reap zombies properly.
(void) signal(SIGCHLD, SIG_IGN);
#endif // !_WIN32

(void) pthread_mutex_init(&ctx->mutex, NULL);
Expand Down

0 comments on commit 75c7f90

Please sign in to comment.