org.apache.hc.core5.http2.impl.nio.ProtocolNegotiationException: Unexpected input

Kapila Thilakarathne 5 Reputation points
2024-11-04T13:15:44.9733333+00:00

We are encountering a ProtocolNegotiationException error when calling NotificationHubClient.sendNotification. The error is intermittent and quite rare, but even on retry, the same error occurs. We are using Notification-Hubs-java-sdk 1.1.0.

Any ideas on where to start troubleshooting? Could this issue be originating from the Azure Notification Hub?

Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
334 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. ajkuma 27,851 Reputation points Microsoft Employee
    2024-11-07T12:31:58.2733333+00:00

    Kapila Thilakarathne, Apologies for the delayed response.

    Based on my understanding you are intermittently (and rarely) receives this error ProtocolNegotiationException when calling NotificationHubClient.sendNotification ( Notification-Hubs-java-sdk 1.1.0.) - Were there any changes made prior to this issue? does the issue reoccur at any specific interval or time?

    The Azure Notification Hubs SDK for Java has a retry policy called the BasicRetryPolicy, which retries based on status codes from Azure Notification Hubs. You might double check if the retry policy is correctly configured and if it needs adjustments

    Intermittent errors can often be attributed to network instability. Please check your network for any issues that might be causing interruptions or packet loss - use network monitoring tools to identify any irregularities during the times when the errors occur.

    If you haven't done, (when the issue reoccurs) you may leverage Notification Hub diagnostics > from Azure Portal> Navigate to your Notification Hub app in the Azure Portal.

    In the left navigation, click on Diagnose and solve problems - Review - “ diagnostics options' to fetch additional info: ( screenshot below)

    User's image

    0 comments No comments

  2. Kapila Thilakarathne 5 Reputation points
    2024-11-07T13:54:19.14+00:00

    Thank for the reply ajkuma. Really appreciate it.

    Customers have reported this issue in environments with varying networks and Notification Hubs, and we have also replicated it internally in R&D.

    The timing of the issue is hard to predict, and our recent changes involved upgrading to the new SDK (Java SDK 1.1.0) to support the FCM migration. We have not seen this issue before and no customer were reported. Also this issue only reported by devices registered with Windows platform so far.

    We implemented a retry logic at the layer where we call the Hub Client to send notifications, but this did not resolve the issue.

    We also checked the diagnostics panel, but it provided no further insights.

    As a next step, we will introduce a slightly longer delay between retries to see if this helps.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.