# After 1 minute, I get this error: "connect() to 127.0.0.1:8080 failed (99: Cannot assign requested a

**URL:** <https://www.ruby-forum.com/t/after-1-minute-i-get-this-error-connect-to-127-0-0-1-8080-failed-99-cannot-assign-requested-a/239121>\
**Category:** NGINX\
**Created:** [February 12, 2014, 8:40pm UTC](https://www.ruby-forum.com/t/after-1-minute-i-get-this-error-connect-to-127-0-0-1-8080-failed-99-cannot-assign-requested-a/239121 "2014-02-12T20:40:23Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Jack\_Andolini](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a9adbd/32.png) [@Jack\_Andolini](https://www.ruby-forum.com/u/Jack_Andolini)\
**Post date:** [February 13, 2014, 1:52pm UTC](https://www.ruby-forum.com/t/after-1-minute-i-get-this-error-connect-to-127-0-0-1-8080-failed-99-cannot-assign-requested-a/239121/2 "2014-02-13T13:52:38Z")

</div>

Hello!

On Wed, Feb 12, 2014 at 02:39:41PM -0500, Jack Andolini wrote:

> - Nginx 1.4.3 receives the requests, and then derives them to Tomcat 7.0.33  
> client: 58.81.5.31, server: [api.acme.com](http://api.acme.com), request: "GET  
> Obviously I’m running out of some kind of resource (ports?). If I wait for  
> root@ip-10-41-156-142:~# sysctl net.ipv4.ip\_local\_port\_range  
> net.ipv4.ip\_local\_port\_range = 32768 61000
> 
> I have read some postings about configuring ports in order to get rid of  
> this error message, but I don’t know if that is my problem.

You’ve run out of local ports due to sockets in TIME-WAIT state.  
There are more than one possible solution, including using lower  
MSL, using bigger local port range, using keepalive connections,  
using unix sockets to connect to backends and so on.

Simpliest solution would be to enable TIME-WAIT sockets reuse,  
with net.ipv4.tcp\_tw\_reuse (or net.ipv4.tcp\_tw\_recycle):

# sysctl net.ipv4.tcp\_tw\_reuse=1

–  
Maxim D.

> **[nginx](http://nginx.org/)**

---

_[View the full topic](https://www.ruby-forum.com/t/after-1-minute-i-get-this-error-connect-to-127-0-0-1-8080-failed-99-cannot-assign-requested-a/239121)._
