How do I troubleshoot IO exception for HTTP or HTTPS endpoint?

2 minute read
0

I want to fix the “IO Exception in HttpClient” error I get when I send a message to HTTP or HTTPS endpoint from Amazon Simple Notification Service (Amazon SNS).

Short description

Amazon SNS sends SubscriptionURL or notification messages to one or more HTTP or HTTPS endpoints. This might generate the "IO Exception in HttpClient" error in ProviderResponse for HTTP or HTTPS endpoints.

Some common reasons for the error:

  • A low-level error from the server indicating either the connection has failed due to non-valid hostname or because the TCP server isn't listening.
  • The TCP connection has abruptly ended due to loss of internet connection.
  • The server isn't able to make a connection due to high network traffic (or lesser bandwidth).

Resolution

  1. "IO Exception in HttpClient" is a generic error. You can resolve it by resending the message manually. However, SNS topic provides a retry mechanism for failed messages. While setting up the retry mechanism for a given SNS policy, consider the following points:
    • The total number of retries must be greater than or equal to sum of no delay, minimum delay, and maximum delay retries.

      numRetries >= numNoDelayRetries + numMinDelayRetries + numMaxDelayRetries
    • The number of retries (function retries) that happen in the back off phase:

      Back off function retries = numRetries - numNoDelayRetries - numMinDelayRetries - numMaxDelayRetries
    • The total maximum retry time is 3600 seconds (the sum of all time for retries). It's a hard limit and can't be increased.

      Total time for retries = Pre-backoff phase (numMinDelayRetries * minDelayTarget) + Post-backoff phase (numMaxDelayRetries * maxDelayTarget) + (Back off function retries)
  2. Make sure that the server has enough bandwidth to receive and process all incoming requests.
  3. Run the netstat command to verify if the TCP server is actively listening to all incoming requests. For more information, see netstat Command on the IBM website.
  4. Make sure that the hostname is valid. Your hostname can't contain an underscore. For example, your_hostname isn't permitted.

Related information

Amazon SNS message delivery retries

AWS OFFICIAL
AWS OFFICIALUpdated 10 months ago