Skip to content

binder: BinderClientTransport should eventually give up waiting for a connection #11137

@jdcormie

Description

@jdcormie

Is your feature request related to a problem?

Yes. Android automatically restarts gRPC/binder servers that crash, with a delay (source). This is generally a good thing -- in-flight calls fail and clients can choose to retry them. But a gRPC/binder server that repeatedly crashes on startup, before onBind() can complete (for example due to corrupt persistent state) can cause very long connection delays on the client. From ServiceBinding's perspective, this looks like a bindService() call that succeeds but no ServiceConnection callback is ever invoked. Without a report of transport failure, the Channel never moves to state TRANSIENT_FAILURE and the usual NameResolver/LoadBalancer machinery doesn't get a chance to try a different address. The waitForReady() call option has no real effect.

Describe the solution you'd like

Use a timer to report transportShutdown()/transportTerminated() if onServiceConnected() isn't called back within some user configurable duration.

Describe alternatives you've considered

Do nothing, trust Android to decide whether to ever give up, and rely on clients to set a deadline on each call.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions