SocketException: OS Error, Connection reset by Peer Android 11

I have an app that is running perfectly in an Android Emulator with an Android 10 OS version. But upon testing it on Android 11. I frequently see this error

I’m running Parse Health Check first every time I start the app. And this is the response

ParseException (Type: UnknownError) :
Code: -1
Message: ----

Followed by

SocketException: OS Error, Connection reset by peer ....

Can someone help me here? I’ve been scratching my head for two days now.

Flutter SDK
Parse Server running on Digital Ocean
Nginx Load Balancer

Do you see any logs on the server side?

This could be an architectural issue in your infrastructure, specifically the timeout configurations of network components.

Hi @Manuel, I am seeing TCP connection resets. But nothing on the Nginx Server. I think this is where I should dig more. I’m currently looking and reading documentation and articles. If you can, do you know what is the cause of this? This doesn’t happen very often. I think it’s 3 out 10.

Yes that’s what I am thinking I have timeouts on the load balancer and on the upstream servers. But how long should I keep them alive?

I’m using Netdata to monitor the server and this is a screenshot

image

So far it sounds like a timeout config issue to me, but you are right in that it needs more investigation. It’s a typical characteristic of timeout mismatches that issues occur only sporadically, making it hard to pin it down at first.

Yeah. Actually in my load balancer I have 2 instances of parse and 2 instances of live query all in different servers. I’m gonna check all of their Nginx configs and get back here if I see something. Thanks @Manuel !

I wrote a post a while ago that explains how timeouts should be adjusted to each other. Specifically for Heroku, but the concept applies also to your infrastructure.

Thanks I’ll go and read that now.

Hey @Manuel thanks for taking me on the right path. I did misconfigure the timeout and keepalive request values on my infrastructure. The load balancer and upstream server don’t have the same values. The same with the HTTP server timeout that you have mentioned in the post you’ve attached. I configured my load balancer and upstream servers to have the same values. Also, all of my parse server instances now have the same values but are different from the Nginx Configuration. I’ll keep monitoring the server logs and see if the issue persists. Thanks again

1 Like

Amazing! Thanks for the update, glad it helped.