# Open socket left in connection

**URL:** <https://www.ruby-forum.com/t/open-socket-left-in-connection/223248>\
**Category:** NGINX\
**Created:** [September 26, 2012, 8:38pm UTC](https://www.ruby-forum.com/t/open-socket-left-in-connection/223248 "2012-09-26T20:38:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [September 26, 2012, 8:38pm UTC](https://www.ruby-forum.com/t/open-socket-left-in-connection/223248/1 "2012-09-26T20:38:00Z")

</div>

We run nginx in front of a python app through proxy\_pass. Occasionally,  
we update the configuration and reload/hup the nginx master. Sometimes,  
we see a line in the error.log like

2012/08/08 02:21:31 [alert] 7153#0: open socket #10 left in connection 5

I see src/os/unix/ngx\_process\_cycle.c outputs this inside  
ngx\_worker\_process\_exit() but I don’t understand the check that it’s  
doing before hand. Can someone explain what is going on when this line  
gets output?

-raylu

---

<div class="post-metadata">

**Author:** ![raylu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ad7895/32.png) [@raylu](https://www.ruby-forum.com/u/raylu)\
**Post date:** [September 27, 2012, 12:05pm UTC](https://www.ruby-forum.com/t/open-socket-left-in-connection/223248/2 "2012-09-27T12:05:19Z")

</div>

Hello!

On Wed, Sep 26, 2012 at 11:37:31AM -0700, raylu wrote:

> We run nginx in front of a python app through proxy\_pass. Occasionally,  
> we update the configuration and reload/hup the nginx master. Sometimes,  
> we see a line in the error.log like
> 
> 2012/08/08 02:21:31 [alert] 7153#0: open socket #10 left in connection 5
> 
> I see src/os/unix/ngx\_process\_cycle.c outputs this inside  
> ngx\_worker\_process\_exit() but I don’t understand the check that it’s  
> doing before hand. Can someone explain what is going on when this line  
> gets output?

It checks if all the sockets are properly closed on process  
shutdown (except ones which are expected to be left open, e.g.  
listening sockets). If there are sockets which aren’t closed - it  
will complain with the message in question. This basically means  
socket leak somewhere.

If you see this message with recent nginx without 3rd party  
modules - you may want to provide more info. Some useful tips how  
to debug this may be found here on wiki:

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

–  
Maxim D.

> **[F5 NGINX: Built for cloud-native apps. Ready for AI traffic.](https://www.f5.com/products/nginx)**
>
> Deliver modern applications with NGINX. Explore high-performance load balancing, API gateways, and web server solutions trusted by top global enterprises.
