fix race on kcrash auto-restarts
Summary:
When kcrash is set to auto restart Unique service processes we have
potential for a race. Because KCrash will want to ideally restart through
kdeinit it only closes the crashed process' sockets after it issues
the restart. Depending on timing the new process may then attempt to
register its service name while the crashed process is still holding the
name. As a result the new process will not actually start because it'll
fail to claim the name.
To mitigate this problem, service registration now will wait for a bit
iff the service name cannot be registered and it cannot successfully hand
over to the registered instance (e.g. the instance is defunct for whatever
reason and not responding to dbus calls).
Alas, this continues to have some race potential. The problem ultimately
is that we do not know why the service name is already registered and also
cannot ask the service since its not responding to calls. To further
restrict the potential of a race the wait time is increased substantially
when the environment variable KCRASH_AUTO_RESTARTED is set.
Test Plan: builds, test passes, doesn't break existing apps
Reviewers: davidedmundson
Reviewed By: davidedmundson
Subscribers: davidedmundson, broulik, kde-frameworks-devel
Tags: Frameworks
Differential Revision: https://phabricator.kde.org/D20078