summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2013-04-16 01:27:12 -0700
committerPatrick Ohly <patrick.ohly@intel.com>2013-05-13 17:49:49 +0200
commite90575224e1ec22701c0a7407234689087411936 (patch)
tree54d026c94662b51cb5d5073ec0282c7323b28d84
parent8db33a4ba5177f1856bc76a30e216d92335a6239 (diff)
D-Bus: fix random session failures
When the helper shuts down normally after the parent is done with it, there was a race between handling the signal and the loss of connection, leading to random "return 1" errors. This showed up in nightly testing in particular in the test-dbus.py testConfigure. The loss of connection at that point is not an error, so don't treat it as one and simply return 0.
-rw-r--r--src/dbus/server/sync-helper.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/dbus/server/sync-helper.cpp b/src/dbus/server/sync-helper.cpp
index 6c38b2a0..89303b80 100644
--- a/src/dbus/server/sync-helper.cpp
+++ b/src/dbus/server/sync-helper.cpp
@@ -163,16 +163,23 @@ int main(int argc, char **argv, char **envp)
return 0;
}
if (forkexec->getState() != ForkExecChild::CONNECTED) {
- // no point running any longer, parent is gone
+ // No point running any longer, parent is gone.
+ //
+ // This can occur during normal operations, so don't
+ // treat it as an error:
+ // - we send final method response
+ // - parent signals us and closes the connection
+ // - our event loop processes these two events such
+ // that we see the "not connected" one first
SE_LOG_DEBUG(NULL, "parent has quit, terminating");
- return 1;
+ return 0;
}
g_main_context_iteration(NULL, true);
}
} catch ( const std::exception &ex ) {
- SE_LOG_ERROR(NULL, "%s", ex.what());
+ SE_LOG_ERROR(NULL, "helper quitting with exception: %s", ex.what());
} catch (...) {
- SE_LOG_ERROR(NULL, "unknown error");
+ SE_LOG_ERROR(NULL, "helper quitting: unknown error");
}
return 1;