diff options
author | Aaron <aaron@10gen.com> | 2009-04-03 11:08:32 -0400 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2009-04-03 11:08:32 -0400 |
commit | c0089eeae791aa5860c36802a94a871b804af264 (patch) | |
tree | 320f5fbad3b850ec0696835bbc260803b9dd4047 /shell/ShellUtils.cpp | |
parent | 3369fd5b762caa2f93bae7387fd8eccdc56fecff (diff) | |
download | mongo-c0089eeae791aa5860c36802a94a871b804af264.tar.gz |
wait for process to end even after killing second time
Diffstat (limited to 'shell/ShellUtils.cpp')
-rw-r--r-- | shell/ShellUtils.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/shell/ShellUtils.cpp b/shell/ShellUtils.cpp index f71550d1ee6..0213aa3a4d4 100644 --- a/shell/ShellUtils.cpp +++ b/shell/ShellUtils.cpp @@ -475,21 +475,23 @@ void killDb( int port, int signal ) { kill( pid, signal ); int i = 0; - for( ; i < 5; ++i ) { + for( ; i < 10; ++i ) { + if ( i == 5 ) { + cout << "process on port " << port << "not terminated, sending sigkill" << endl; + kill( pid, SIGKILL ); + } int temp; if( waitpid( pid, &temp, WNOHANG ) == pid ) break; cout << "waiting for process on port " << port << " to terminate" << endl; sleepms( 1000 ); } - if ( i == 5 ) { - cout << "process on port " << port << "not terminated, sending sigkill" << endl; - kill( pid, SIGKILL ); - } + if ( i == 10 ) + assert( "Failed to terminate process" == 0 ); close( dbs[ port ].second ); dbs.erase( port ); - if ( signal == SIGKILL || i == 5 ) { + if ( i > 4 || signal == SIGKILL ) { cout << "sleeping after sigkill" << endl; sleepms( 4000 ); // allow operating system to reclaim resources } |