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

fix(uat): change error processing in paho-java-client #381

Conversation

auarbekov
Copy link

Issue #, if available:
fix error processing in paho-java-client

Description of changes:

  • change error processing
  • add isClosing boolean for callback

Why is this change necessary:
Implement scenarios

How was this change tested:
Start the local broker and shutdown the broker after a successful connection.

Test results:

[INFO ] 2023-07-27 21:08:36.788 [main] GRPCLinkImpl - Making gPRC client connection with 127.0.0.1:47619 as client1...
[INFO ] 2023-07-27 21:08:37.244 [main] GRPCLinkImpl - Client connection with Control is established, local address is 127.0.0.1
[INFO ] 2023-07-27 21:08:37.264 [main] GRPCControlServer - GRPCControlServer created and listed on 127.0.0.1:35873
[INFO ] 2023-07-27 21:08:37.336 [main] GRPCLinkImpl - Handle gRPC requests
[INFO ] 2023-07-27 21:08:37.337 [main] GRPCControlServer - Server awaitTermination
[INFO ] 2023-07-27 21:08:40.391 [grpc-default-executor-0] GRPCControlServer - createMqttConnection: clientId client1 broker server:10101
[INFO ] 2023-07-27 21:08:40.408 [grpc-default-executor-0] MqttConnectionImpl - CONNECT Tx user property 'region':'US'
[INFO ] 2023-07-27 21:08:40.409 [grpc-default-executor-0] MqttConnectionImpl - CONNECT Tx user property 'type':'JSON'
[INFO ] 2023-07-27 21:08:40.409 [grpc-default-executor-0] MqttConnectionImpl - CONNECT Tx request response information: true
[INFO ] 2023-07-27 21:08:41.831 [MQTT Rec: client1] MqttConnectionImpl - MQTT connectionId 1 disconnected error 'Connection lost' disconnectInfo 'com.aws.greengrass.testing.mqtt5.client.GRPCClient$DisconnectInfo@23a4a06d'
[INFO ] 2023-07-27 21:08:45.807 [grpc-default-executor-0] GRPCControlServer - Subscription: filter 'test/topic' QoS 0 noLocal false retainAsPublished false retainHandling 2
[INFO ] 2023-07-27 21:08:45.807 [grpc-default-executor-0] GRPCControlServer - Subscribe: connectionId 1 for 1 filters
[ERROR] 2023-07-27 21:08:45.807 [grpc-default-executor-0] GRPCControlServer - exception during subscribe
com.aws.greengrass.testing.mqtt5.client.exceptions.MqttException: MQTT client is not in connected state
	at com.aws.greengrass.testing.mqtt5.client.paho.MqttConnectionImpl.stateCheck(MqttConnectionImpl.java:626) ~[classes/:?]
	at com.aws.greengrass.testing.mqtt5.client.paho.MqttConnectionImpl.subscribe(MqttConnectionImpl.java:107) ~[classes/:?]
	at com.aws.greengrass.testing.mqtt5.client.grpc.GRPCControlServer$MqttClientControlImpl.subscribeMqtt(GRPCControlServer.java:458) [classes/:?]
	at com.aws.greengrass.testing.mqtt.client.MqttClientControlGrpc$MethodHandlers.invoke(MqttClientControlGrpc.java:659) [classes/:?]
	at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182) [grpc-stub-1.53.0.jar:1.53.0]
	at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:355) [grpc-core-1.53.0.jar:1.53.0]
	at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:867) [grpc-core-1.53.0.jar:1.53.0]
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) [grpc-core-1.53.0.jar:1.53.0]
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) [grpc-core-1.53.0.jar:1.53.0]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_361]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_361]
	at java.lang.Thread.run(Thread.java:750) [?:1.8.0_361]
[INFO ] 2023-07-27 21:08:45.825 [grpc-default-executor-0] GRPCControlServer - closeMqttConnection: connectionId 1 reason 4
[INFO ] 2023-07-27 21:08:45.826 [grpc-default-executor-0] MqttConnectionImpl - Disconnect MQTT userProperties: region, US
[INFO ] 2023-07-27 21:08:45.826 [grpc-default-executor-0] MqttConnectionImpl - Disconnect MQTT userProperties: type, JSON
[WARN ] 2023-07-27 21:08:45.826 [grpc-default-executor-0] MqttConnectionImpl - DISCONNECT was not sent on the dead connection
[INFO ] 2023-07-27 21:08:45.837 [grpc-default-executor-0] GRPCControlServer - shutdownAgent: reason 'That's it.'
[INFO ] 2023-07-27 21:08:45.890 [main] GRPCControlServer - Server awaitTermination done
[INFO ] 2023-07-27 21:08:45.890 [main] GRPCLinkImpl - Shutdown gPRC link
[INFO ] 2023-07-27 21:08:45.902 [main] Main - Execution done successfully

Any additional information or context required to review the change:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@MikeDombo MikeDombo merged commit f3f2d38 into aws-greengrass:uat-dev Jul 27, 2023
6 of 7 checks passed
@auarbekov auarbekov deleted the GGMQ-276-control-received-non-existent-reason-code-32104 branch July 28, 2023 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants