hedera-sdk-java icon indicating copy to clipboard operation
hedera-sdk-java copied to clipboard

TopicMessageQuery unsubscribe logs a stacktrace

Open steven-sheehy opened this issue 2 years ago • 0 comments

Description

Subscribing to a TopicMessageQuery and later cancelling it logs a misleading stacktrace by default. A cancellation signal is a normal operation that occurs all the time and should not be treated as an exception worthy of a stacktrace. It's not an error and there is no action to be taken since the cancel was requested by the user.

2022-10-04T09:17:22.363-0600 ERROR hedera-sdk-0 c.h.h.s.TopicMessageQuery Error attempting to subscribe to topic 0.0.1049: io.grpc.StatusRuntimeException: CANCELLED: unsubscribe
	at io.grpc.Status.asRuntimeException(Status.java:535)
	at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:487)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:563)
	at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70)

Steps to reproduce

var subscription = new TopicMessageQuery()
  .setTopicId(consensusTopicId)
  .setStartTime(Instant.EPOCH)
  .subscribe(client, r -> {});

subscription.unsubscribe();

Additional context

No response

Hedera network

mainnet

Version

2.17.3

Operating system

No response

steven-sheehy avatar Oct 04 '22 15:10 steven-sheehy