-
Notifications
You must be signed in to change notification settings - Fork 99
Closed
Labels
api: pubsubIssues related to the googleapis/java-pubsub API.Issues related to the googleapis/java-pubsub API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.status: duplicateDuplicate.Duplicate.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Environment details
- PubSub: google-cloud-pubsub-1.98.0
- Ubuntu 19.04, x64
- Java version: zulu8.38.0.13-ca-jdk8.0.212-linux_x64
- 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
- Configure Subscriber
- Start Subscriber, receive several messages, send ack.
- Stop Subscriber, await termination.
- Don's stop JVM, check connections using nenstat, for example: netstat -natp | grep java | grep 443
- There is at least one established connection.
- Also logs contain messages like following:
io.grpc.internal.AbstractClientStream$TransportState inboundDataReceived
INFO: Received data on closed stream
- 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.
benbenw
Metadata
Metadata
Assignees
Labels
api: pubsubIssues related to the googleapis/java-pubsub API.Issues related to the googleapis/java-pubsub API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.status: duplicateDuplicate.Duplicate.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.