actions-on-google-java: SmartHomeApp.reportState error

Is this error below because the grpc-core version is too low?

io.grpc.internal.ManagedChannelOrphanWrapper line:163 -*~*~*~ Channel ManagedChannelImpl{logId=144961, target=homegraph.googleapis.com} 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:103) [grpc-core-1.15.1.jar:1.15.1]
	at io.grpc.internal.ManagedChannelOrphanWrapper.<init>(ManagedChannelOrphanWrapper.java:53) [grpc-core-1.15.1.jar:1.15.1]
	at io.grpc.internal.ManagedChannelOrphanWrapper.<init>(ManagedChannelOrphanWrapper.java:44) [grpc-core-1.15.1.jar:1.15.1]
	at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:410) [grpc-core-1.15.1.jar:1.15.1]
	at com.google.actions.api.smarthome.SmartHomeApp.reportState(SmartHomeApp.kt:126) [actions-on-google-1.5.0.jar:?] 

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 1
  • Comments: 33 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Sorry for not seeing the @mention earlier.

It seems that action-on-google-java creates a new ManagedChannel on every request: https://github.com/actions-on-google/actions-on-google-java/blob/master/src/main/kotlin/com/google/actions/api/smarthome/SmartHomeApp.kt#L126

As pointed by @cbeaujoin in https://github.com/actions-on-google/actions-on-google-java/issues/30#issuecomment-529400776 and comments in the official gRPC sample for Java: https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldClient.java#L96 such channels should be explicitly shutdown when no longer being used to prevent leaks.

A workaround could be for client to directly depends on the HomeGraph API Client Library for Java https://github.com/googleapis/google-api-java-client-services/tree/master/clients/google-api-services-homegraph/v1 instead of using the reportState helper and reuse a single channel tied to the lifetime of the application.

@proppy proppy can you supply a demo?(A workaround could be for client to directly depends on the HomeGraph API Client Library for Java )

@Fleker Hi,how is this issue?it’s a long time.