actions-on-google-java icon indicating copy to clipboard operation
actions-on-google-java copied to clipboard

ManagedChannelImpl was not shutdown properly

Open jasperrosiers opened this issue 4 years ago • 3 comments

The error I put below, where a ManagedChannel was not shut down properly. I have read this issue, but couldn't find a solution: .

I have basically completely copied the code from Google's docs. I will put the faulty class below the error as well. I have tried finding a "shutdown" method on all of the variables, but there aren't any, so I'm not sure what I should do.

2021-01-18 19:21:59.443 ERROR 1 --- [nio-8080-exec-8] i.g.i.ManagedChannelOrphanWrapper        : *~*~*~ Channel ManagedChannelImpl{logId=157, 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.8.0.jar!/:na]                                                                                                                  │
│     at ordina.engie.googlehome.google.services.ReportStateService.reportState(ReportStateService.java:41) ~[classes!/:0.0.1-SNAPSHOT]                                                                                                      │
│     at ordina.engie.googlehome.toon.controllers.ToonController.reportToGoogle(ToonController.java:27) ~[classes!/:0.0.1-SNAPSHOT]

The method where the error happens:

public void reportState(String requestId, String commonName, ThermostatInfo thermostatInfo) {
        Value deviceStates =
                Value.newBuilder()
                        .setStructValue(
                                Struct.newBuilder()
                                        .putFields(HOME_RESPONSE_KEY_ONLINE, Value.newBuilder().setBoolValue(true).build())
                                        .putFields(HOME_RESPONSE_KEY_MODE, Value.newBuilder().setStringValue(smartHomeHelperService.calculateThermostatMode(thermostatInfo)).build())
                                        .putFields(HOME_RESPONSE_KEY_SETPOINT, Value.newBuilder().setNumberValue(thermostatInfo.getCurrentSetpoint()).build())
                                        .putFields(HOME_RESPONSE_KEY_AMBIENT, Value.newBuilder().setNumberValue(thermostatInfo.getCurrentDisplayTemp()).build())
                                        .build())
                        .build();

        Struct requestStates = Struct.newBuilder().putFields(commonName, deviceStates).build();

        HomeGraphApiServiceProto.ReportStateAndNotificationResponse response =
                engieSmartHomeAppService.reportState(
                        HomeGraphApiServiceProto.ReportStateAndNotificationRequest.newBuilder()
                                .setRequestId(requestId)
                                .setAgentUserId(commonName)
                                .setPayload(
                                        HomeGraphApiServiceProto.StateAndNotificationPayload.newBuilder()
                                                .setDevices(
                                                        HomeGraphApiServiceProto.ReportStateAndNotificationDevice.newBuilder()
                                                                .setStates(requestStates)
                                                                .build())
                                                .build())
                                .build());
    }

jasperrosiers avatar Jan 18 '21 19:01 jasperrosiers

Hi, I just faced the same issue, does anyone know the reason?

jiangxin369 avatar Sep 18 '21 03:09 jiangxin369

Me too

aykborstelmann avatar Apr 04 '22 14:04 aykborstelmann

Same here, this PR is supposed to fix it but I can't apply it, what I faced it I described it here Does anyone know how to apply that PR

EgHubs avatar Apr 28 '22 00:04 EgHubs