Skip to content

Connection reset by peer publishing event

0

Hello, sometimes, I get plenty of "Connection reset by peer" while publishing to AppSync Event Api via HTTP rest API via associated custom domain. What can be the cause? What can I do to avoid this kind of errors?

Thanks

asked 2 years ago678 views

3 Answers
1

The "Connection reset by peer" error you're experiencing while publishing to AppSync Event API via HTTP REST API could be caused by several factors. Here are some potential causes and solutions to consider:

  1. Network Disruptions: Switching between network connections (e.g., from WiFi to mobile data) can disrupt WebSocket connections, which are used by AppSync for real-time data delivery.

  2. Intermittent Connectivity Issues: There might be temporary problems with specific AWS edge locations or network congestion between your client and the AppSync endpoint.

  3. Timeouts: If your connection is timing out, it could lead to this error.

  4. Security Group or Firewall Settings: Ensure that your security groups and firewalls are correctly configured to allow the necessary traffic.

To mitigate these issues and avoid such errors, you can try the following approaches:

  1. Implement Retry Logic: Add a retry mechanism with exponential backoff to your publishing code. This can help overcome temporary network issues.

  2. Use AWS SDK's Built-in Reconnection: If you're using the AWS Amplify SDK, leverage its native reconnection capabilities instead of manually rebuilding the connection on every network switch.

  3. Monitor Connection State: Implement connection status listeners to check when the WebSocket truly disconnects and only attempt to reconnect when necessary.

  4. Optimize Network Settings: Review and optimize your network configuration, including any proxies or load balancers that might be in use.

  5. Increase Timeouts: If applicable, try increasing timeout settings in your application.

  6. Use Connection Validation: Implement a simple ping/pong mechanism to confirm if a connection is truly inactive before attempting to reestablish it.

  7. Review AppSync Configuration: Ensure your AppSync setup, including any custom domain configurations, is correct and up-to-date.

If the issue persists after implementing these measures, it may be worthwhile to contact AWS Support for a more in-depth investigation of your specific setup and usage patterns.
Sources
AWS AppSync Subscriptions Disrupt on Network Changes | AWS re:Post
OpenSSL SSL_read: Connection reset by peer, errno 104 | AWS re:Post

answered 2 years ago

EXPERT

reviewed 2 years ago

0

I publish the events inside the AWS itself from my EC2 behind nat gateway. I believe connectivity issues should not be the case.

answered 2 years ago

0

Are you be able to resolve this issue ? If so, share the fix details(if possible), so that others can benefit. Still you're facing this issue, let me know, what SDK (Python / C# ) etc you're using and let's try to solve this issue.

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.