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.
This commit is contained in:
parent
8db33a4ba5
commit
e90575224e
1 changed files with 11 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue