Iliyan Malchev 1d8843897e service_manager: duplicate registrations override previous ones
When a process that has registered one or several binder services with
the service manager crashes, that process will usually be restarted by
init (see init.rc).  When the process comes back up, it will attempt
to re-register itself with the service manager.  However, the binder
driver may not deliver the death notification to the service manager
before the the new service-registation request, in which case the
service manager will reject the request as a duplicate.

The same may occur if a process takes a while to actually exit.  Since
the init language's restart command does not wait for a process to
exit before restarting it, there may be for a brief instant two
processes.  The new one will attempt to register before the old
one has exited, causing the same problem.

This patch does not treat duplicate registrations as an error.
Instead, the service manager force-releases the old instance and
proceeds with registering the new instance of a service.

Change-Id: Ib70640ab13f5e22460fff6af2f9520b8a9ac9713
Signed-off-by: Iliyan Malchev <malchev@google.com>
2010-12-08 18:27:29 -08:00
..