Skip to content

BinderClientTransport instance retained post-termination if the destination AndroidComponentAddress doesn't exist #8726

@jdcormie

Description

@jdcormie

What version of gRPC-Java are you using?

latest

What is your environment?

Android/Linux

Steps to reproduce the bug

  1. Call BinderChannelBuilder.forAddress() on a directAddress whose package or Service class name doesn't exist.
  2. Send a request over the new Channel to activate it.
  3. Observe the request fail with UNIMPLEMENTED as expected.
  4. shutdown() the Channel and awaitTermination()

What did you expect to see?

No remaining Java references to Channel related resources.

What did you see instead?

Heap dump shows a strong reference to the ServiceBinding in android.app.LoadedApk#mServices (as a ServiceConnection) even after termination.

The problem is that ServiceBinding fails to call Context#unbindService() when bindService() returns false. (See b/37092557 for discussion / longstanding confusion on when to call unbindService())

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions