Score:0

nginx throwing 502 Bad Gateway after a period of time

in flag

We have a problem with our Nginx instance on Ubuntu (WSL) running on Windows 2019 server. We are using it as a load balancer.

It works fine but after a period of time Nginx starts throwing 502 bad gateway. Restarting the server fixes this but how do we prevent it?

jp flag
Read the server logs.
Score:0
in flag

Yeah we were just beginning to use nginx & we did not even have it set up for logging.

The problem specifically was :

TCP/IP failed to establish an outgoing connection because the selected local endpoint was recently used to connect to the same remote endpoint. This error typically occurs when outgoing connections are opened and closed at a high rate, causing all available local ports to be used and forcing TCP/IP to reuse a local port for an outgoing connection. To minimize the risk of data corruption, the TCP/IP standard requires a minimum time period to elapse between successive connections from a given local endpoint to a given remote endpoint.

This problem was due to port exhaustion. After opening more ports this problem cleared up.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.