# nginx randomly hangs after 12.0 upgrade



## BachiloDmitry (May 24, 2019)

So there's the webserver running nginx + apache + php + mysql. Everything worked fine on 11.2-RELEASE until freebsd-update -r 12.0-RELEASE
The first thing that happened (besides this: https://forums.freebsd.org/threads/...-boot-lua-loader-lua.68635/page-2#post-424238) is that nginx started to give me a 502. It means that it basically works, but one of the processes stops responding, so it can't get actual data.

I started to dig it up and first I've noticed that there were messages appearing in the console:

```
sonewconn: pcb 0xfffff8015e7ceb70: Listen queue overflow: 193 already in queue awaiting acceptance (239 occurrences)
```

Ok, so that means that FreeBSD suddenly can't handle the amount of tcp connections to 80 port, and the default value is very strange, 128 simultaneous connections. Very well, I encreased kern.ipc.somaxconn at first to 1024, then to 4096 and now it's 8192, but the only thing that changed is that there is no more such messages in dmesg, but the problem remains the same: once a day nginx just stops serving pages giving 502 instead, stops writing anything in error.log and would not restart via rc.d script nor would it die with killall -9, so only total system reboot will bring it back to life, which in, say, one time out of ten wouldn't work either, the reboot will hang at trying to kill nginx forever. 

I'm just out of ideas what else can I tune to make nginx work like it used to. There are plenty of memory remaining when this happens, swap is free, cpu usage is 0% and everything else on the server works fine.


----------



## CyberCr33p (May 25, 2019)

I use FreeBSD 12.0 and no issues with Nginx.

Maybe your filesystem has issues and makes Nginx to hang. Try fsck to see if it helps.


----------

