Skip to content

[BUG] Connection closed while dispatching a push notification #168

@dodokaa

Description

@dodokaa

Describe the bug
After updating from 'com.windowsazure:Notification-Hubs-java-sdk:0.4.2' to 'com.windowsazure:Notification-Hubs-java-sdk:1.0.4'
we noticed that sometimes we are getting azure hub failures with connection closed.
Usually the dispatching succeeds.

Exception or Stack Trace
com.dodokaa.notification.dispatcher.client.pnprovider.exception.PnProviderException: Push notification send failed: Connection is closed
at com.dodokaa.notification.dispatcher.client.pnprovider.service.AzurePushNotificationDispatcherImpl.lambda$sendDirectNotification$10(AzurePushNotificationDispatcherImpl.java:176)
at com.dodokaa.notification.dispatcher.client.pnprovider.service.AzurePushNotificationDispatcherImpl$2.failed(AzurePushNotificationDispatcherImpl.java:593)
at com.windowsazure.messaging.NotificationHubsService$1.failed(NotificationHubsService.java:78)
at datadog.trace.instrumentation.apachehttpclient5.TraceContinuedFutureCallback.failDelegate(TraceContinuedFutureCallback.java:105)
at datadog.trace.instrumentation.apachehttpclient5.TraceContinuedFutureCallback.failed(TraceContinuedFutureCallback.java:75)
at org.apache.hc.core5.concurrent.BasicFuture.failed(BasicFuture.java:138)
at org.apache.hc.core5.concurrent.ComplexFuture.failed(ComplexFuture.java:79)
at org.apache.hc.client5.http.impl.async.InternalAbstractHttpAsyncClient$1.failed(InternalAbstractHttpAsyncClient.java:326)
at org.apache.hc.client5.http.impl.async.AsyncRedirectExec$1.failed(AsyncRedirectExec.java:246)
at org.apache.hc.client5.http.impl.async.AsyncHttpRequestRetryExec$1.failed(AsyncHttpRequestRetryExec.java:168)
at org.apache.hc.client5.http.impl.async.AsyncProtocolExec$1.failed(AsyncProtocolExec.java:295)
at org.apache.hc.client5.http.impl.async.H2AsyncMainClientExec$1.failed(H2AsyncMainClientExec.java:119)
at org.apache.hc.core5.http.nio.command.RequestExecutionCommand.failed(RequestExecutionCommand.java:101)
at org.apache.hc.core5.http2.impl.nio.AbstractH2StreamMultiplexer.onDisconnect(AbstractH2StreamMultiplexer.java:580)
at org.apache.hc.core5.http2.impl.nio.AbstractH2IOEventHandler.disconnected(AbstractH2IOEventHandler.java:96)
at org.apache.hc.core5.http2.impl.nio.ClientH2IOEventHandler.disconnected(ClientH2IOEventHandler.java:39)
at org.apache.hc.core5.reactor.ssl.SSLIOSession$1.disconnected(SSLIOSession.java:247)
at org.apache.hc.core5.reactor.InternalDataChannel.disconnected(InternalDataChannel.java:204)
at org.apache.hc.core5.reactor.SingleCoreIOReactor.processClosedSessions(SingleCoreIOReactor.java:231)
at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:133)
at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:86)
at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)
at java.base/java.lang.Thread.run(Thread.java:833)

To Reproduce
update from 'com.windowsazure:Notification-Hubs-java-sdk:0.4.2' to 'com.windowsazure:Notification-Hubs-java-sdk:1.0.4'

Expected behavior
We should not have connection closed issues since before the library update we received no issues.

Setup:

  • Version of the Library used: 'com.windowsazure:Notification-Hubs-java-sdk:1.0.4'

Additional context
I have noticed the following change in the sendDirectNotificationAsync functions FutureCallback parameter:
void sendDirectNotificationAsync(
Notification notification,
String deviceHandle,
FutureCallback callback
);.

import org.apache.http.concurrent.FutureCallback; <--- com.windowsazure:Notification-Hubs-java-sdk:0.4.2
import org.apache.hc.core5.concurrent.FutureCallback; <--- 'com.windowsazure:Notification-Hubs-java-sdk:1.0.4'

Information Checklist

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions