[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r12114: Forcibly kill the child proc
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r12114: Forcibly kill the child process if all else fails. Fix another std::string bug. |
Date: |
Fri, 26 Mar 2010 05:03:47 +0100 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 12114
committer: Bastiaan Jacques <address@hidden>
branch nick: trunk
timestamp: Fri 2010-03-26 05:03:47 +0100
message:
Forcibly kill the child process if all else fails. Fix another std::string
bug.
modified:
plugin/npapi/plugin.cpp
=== modified file 'plugin/npapi/plugin.cpp'
--- a/plugin/npapi/plugin.cpp 2010-03-26 02:21:50 +0000
+++ b/plugin/npapi/plugin.cpp 2010-03-26 04:03:47 +0000
@@ -364,9 +364,29 @@
if (_childpid > 0) {
// When the child has terminated (signaled by _controlfd), it remains
// as a defunct process and we remove it from the kernel table now.
+
+ // If all goes well, Gnash will already have terminated.
int status;
- waitpid(_childpid, &status, 0);
- logDebug("Child process exited with status " + status);
+ int rv = waitpid(_childpid, &status, WNOHANG);
+
+ if (rv <= 0) {
+ // The childprocess has not exited; it may be deadlocked.
+ // We'll first try a gentle approach... which probably won't work.
+ logError("Child process ignored fd closure; trying SIGTERM.
(bug)");
+ kill(_childpid, SIGTERM);
+ rv = waitpid(_childpid, &status, WNOHANG);
+
+ if (rv <= 0) {
+ // That still didn't work. Try to force-kill the process...
+ logError("Child process ignored SIGTERM. Trying SIGKILL.
(BUG)");
+ kill(_childpid, SIGKILL);
+ waitpid(_childpid, &status, 0);
+ }
+ }
+
+#if GNASH_PLUGIN_DEBUG > 1
+ std::cout << "Child process exited with status " << status <<
std::endl;
+#endif
}
_childpid = 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r12114: Forcibly kill the child process if all else fails. Fix another std::string bug.,
Bastiaan Jacques <=