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

PubSub: Subscriber doesn't close connections after stopAsync #28

Closed
kegorof opened this issue Oct 25, 2019 · 1 comment
Closed

PubSub: Subscriber doesn't close connections after stopAsync #28

kegorof opened this issue Oct 25, 2019 · 1 comment
Assignees
Labels
api: pubsub Issues related to the googleapis/java-pubsub API. priority: p2 Moderately-important priority. Fix may not be included in next release. status: duplicate Duplicate. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@kegorof
Copy link

kegorof commented Oct 25, 2019

Environment details

  1. PubSub: google-cloud-pubsub-1.98.0
  2. Ubuntu 19.04, x64
  3. Java version: zulu8.38.0.13-ca-jdk8.0.212-linux_x64
  4. google-cloud-java version(s): google-cloud-core-1.91.3.jar, google-cloud-core-grpc-1.91.3.jar, google-cloud-pubsub-1.98.0.jar

Steps to reproduce

  1. Configure Subscriber
  2. Start Subscriber, receive several messages, send ack.
  3. Stop Subscriber, await termination.
  4. Don's stop JVM, check connections using nenstat, for example: netstat -natp | grep java | grep 443
  5. There is at least one established connection.
  6. Also logs contain messages like following:

io.grpc.internal.AbstractClientStream$TransportState inboundDataReceived
INFO: Received data on closed stream

  1. There are several runnable threads "grpc-default-worker-ELG-..."

Code example

// configure subscriber (from samples)
subscriber.startAsync().awaitRunning();
Thread.sleep(30000); //some messages are received
subscriber.stopAsync().awaitTerminated();
// do other job, check connections using netstat
Thread.sleep(Long.MAX_VALUE);

It looks like that the Subscriber instance doesn't shutdown the field com.google.cloud.pubsub.v1.Subscriber#subStub. This field isn't added to the backgroundResources, also shutdown() or shutdownNow() method isn't called. That's why grpc channel isn't closed.
Whey I call subStub.shutdownNow() using java reflection, the problem disappears.

@chingor13 chingor13 transferred this issue from googleapis/google-cloud-java Dec 4, 2019
@chingor13 chingor13 added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Dec 4, 2019
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Dec 6, 2019
@hannahrogers-google hannahrogers-google added duplicate This issue or pull request already exists status: duplicate Duplicate. and removed duplicate This issue or pull request already exists labels Jan 9, 2020
@hannahrogers-google
Copy link
Contributor

Duplicate of #22

@hannahrogers-google hannahrogers-google marked this as a duplicate of #22 Jan 9, 2020
@hannahrogers-google hannahrogers-google added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Jan 9, 2020
@yoshi-automation yoshi-automation removed the 🚨 This issue needs some love. label Jan 9, 2020
@google-cloud-label-sync google-cloud-label-sync bot added the api: pubsub Issues related to the googleapis/java-pubsub API. label Jan 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/java-pubsub API. priority: p2 Moderately-important priority. Fix may not be included in next release. status: duplicate Duplicate. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

4 participants