0

We have a server application running behind nginx, and the client side will keep getting and writing data to it through HTTP request but should return really fast.

After running sometime, client side start receiving HTTP 502 Bad Gateway error, and then the following attempt will drop within a short period.

I investigate the niginx error log and saw this message

connect() to 127.0.0.1:8889 failed (99: Cannot assign requested address) while connecting to upstream

I search online and seems like the issue is because local ip/port has limit and cannot free them fast enough.

I am wondering in this case, increate the range is the best solution? Since I also see some article suggest to turn on keep alive or increase buffer size.

This is our Nginx config:

server {
    server_name foo;
    ...
    location /bar/ {
        proxy_pass http://localhost:8889;
    }
}

Client side will keep sending HTTP GET/POST to foo/bar/xxxxx and the HTTP request will keep getting 502 but not all the time.

gogog22510
  • 1
  • 1
  • 1
  • 3
  • Why do you believe that "the issue is because local ip/port has limit and cannot free them fast enough"? Do you have some evidence of this? If so, please add it to your question. – Michael Hampton Jan 19 '18 at 19:36
  • it is based on the nginx log I saw and the answer I got when I search online. However, based on the message and the fact the server not dead and finally the request will go through – gogog22510 Jan 22 '18 at 20:08

0 Answers0