Skip to content
This repository was archived by the owner on Dec 23, 2023. It is now read-only.
This repository was archived by the owner on Dec 23, 2023. It is now read-only.

StackdriverStatsExporter does not shut down the MetricServiceClient #2007

@jgogstad

Description

@jgogstad

Please answer these questions before submitting a bug report.

What version of OpenCensus are you using?

"io.opencensus" % "opencensus-exporter-stats-stackdriver" % "0.24.0"

What JVM are you using (java -version)?

$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

What did you do?

StackdriverStatsExporter.createAndRegister()
StackdriverStatsExporter.unregister()
StackdriverStatsExporter.createAndRegister()

The issue is that unregister doesn't clean up the resources it allocates though. The code above just demonstrates it.

What did you expect to see?

No exceptions

What did you see instead?

Feb 07, 2020 9:27:18 AM io.grpc.internal.ManagedChannelOrphanWrapper$ManagedChannelReference cleanQueue
SEVERE: *~*~*~ Channel ManagedChannelImpl{logId=17, target=monitoring.googleapis.com:443} was not shutdown properly!!! ~*~*~*
    Make sure to call shutdown()/shutdownNow() and wait until awaitTermination() returns true.
java.lang.RuntimeException: ManagedChannel allocation site
	at io.grpc.internal.ManagedChannelOrphanWrapper$ManagedChannelReference.<init>(ManagedChannelOrphanWrapper.java:94)
	at io.grpc.internal.ManagedChannelOrphanWrapper.<init>(ManagedChannelOrphanWrapper.java:52)
	at io.grpc.internal.ManagedChannelOrphanWrapper.<init>(ManagedChannelOrphanWrapper.java:43)
	at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:512)
	at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:268)
	at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:185)
	at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:177)
	at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:155)
	at com.google.cloud.monitoring.v3.stub.GrpcMetricServiceStub.create(GrpcMetricServiceStub.java:176)
	at com.google.cloud.monitoring.v3.stub.MetricServiceStubSettings.createStub(MetricServiceStubSettings.java:187)
	at com.google.cloud.monitoring.v3.MetricServiceClient.<init>(MetricServiceClient.java:157)
	at com.google.cloud.monitoring.v3.MetricServiceClient.create(MetricServiceClient.java:138)
	at io.opencensus.exporter.stats.stackdriver.StackdriverStatsExporter.createMetricServiceClient(StackdriverStatsExporter.java:422)
	at io.opencensus.exporter.stats.stackdriver.StackdriverStatsExporter.createInternal(StackdriverStatsExporter.java:388)
	at io.opencensus.exporter.stats.stackdriver.StackdriverStatsExporter.createAndRegister(StackdriverStatsExporter.java:221)

Additional context

The issue is that StackdriverStatsExporter allocates a MetricServiceClient, but fails to invoke client.shutdown or client.shutdownNow on StackdriverStatsExporter.unregister()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions