Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jdcormie opened this issue Nov 25, 2021 · 3 comments · Fixed by #8861
Assignees
Labels
Milestone

Comments

@jdcormie
Copy link
Member

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())

@sanjaypujare
Copy link
Contributor

@markb74 could you comment on this?

@markb74
Copy link
Contributor

markb74 commented Nov 29, 2021

Agreed, that's an unhandled edge case in ServiceBinding.

@sanjaypujare
Copy link
Contributor

Agreed, that's an unhandled edge case in ServiceBinding.

Can this be assigned to you? Unless @jdcormie is planning to work on this...

@jdcormie jdcormie self-assigned this Nov 29, 2021
@ejona86 ejona86 added this to the Next milestone Nov 30, 2021
@ejona86 ejona86 added the bug label Nov 30, 2021
jdcormie added a commit that referenced this issue Jan 25, 2022
@ejona86 ejona86 modified the milestones: Next, v1.45 Feb 7, 2022
ejona86 pushed a commit to ejona86/grpc-java that referenced this issue Feb 9, 2022
ejona86 pushed a commit that referenced this issue Feb 9, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants