<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body style="background-color: rgb(255, 255, 255); color: rgb(0, 0,
0);" bgcolor="#FFFFFF" text="#000000">
We've used nginx for years and never had an issue with nginx upgrade
until today where the upgrade command ran but almost instantly after
the new process exited.<br>
<br>
/usr/local/etc/rc.d/nginx upgrade<br>
Performing sanity check on nginx configuration:<br>
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax
is ok<br>
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is
successful<br>
Upgrading nginx binary:<br>
Stopping old binary:<br>
<br>
In the default nginx log we had:<br>
2016/12/04 21:18:22 [emerg] 25435#0: bind() to 127.0.0.1:81 failed
(48: Address already in use)<br>
nginx: [emerg] bind() to 127.0.0.1:81 failed (48: Address already in
use)<br>
2016/12/04 21:18:22 [emerg] 25435#0: bind() to 127.0.0.1:81 failed
(48: Address already in use)<br>
nginx: [emerg] bind() to 127.0.0.1:81 failed (48: Address already in
use)<br>
2016/12/04 21:18:22 [emerg] 25435#0: bind() to 127.0.0.1:81 failed
(48: Address already in use)<br>
nginx: [emerg] bind() to 127.0.0.1:81 failed (48: Address already in
use)<br>
2016/12/04 21:18:22 [emerg] 25435#0: bind() to 127.0.0.1:81 failed
(48: Address already in use)<br>
nginx: [emerg] bind() to 127.0.0.1:81 failed (48: Address already in
use)<br>
2016/12/04 21:18:22 [emerg] 25435#0: bind() to 127.0.0.1:81 failed
(48: Address already in use)<br>
nginx: [emerg] bind() to 127.0.0.1:81 failed (48: Address already in
use)<br>
2016/12/04 21:18:22 [emerg] 25435#0: still could not bind()<br>
nginx: [emerg] still could not bind()<br>
<br>
Running the start just after resulted in a running version but is
obviously unexpected to have upgrade result in a failure.<br>
<br>
I believe the change to add a localhost bind to the server in
question was relatively recent so I suspect it has something to do
with that.<br>
<br>
The config for this is simply:<br>
server {<br>
listen 127.0.0.1:81;<br>
server_name localhost;<br>
<br>
location /status {<br>
stub_status;<br>
}<br>
}<br>
<br>
The upgrade in this case was:<br>
nginx: 1.10.1_1,2 -> 1.10.2_2,2<br>
<br>
Now this server is running under FreeBSD in a jail (10.2-RELEASE)
and it has 127.0.0.1 available yet it seems nginx has incorrectly
bound the address:<br>
netstat -na | grep LIST | grep 81<br>
tcp4 0 0 10.10.96.146.81 *.*
LISTEN<br>
<br>
sockstat | grep :81<br>
www nginx 25666 25 tcp4 10.10.96.146:81 *:*<br>
www nginx 25665 25 tcp4 10.10.96.146:81 *:*<br>
www nginx 25664 25 tcp4 10.10.96.146:81 *:*<br>
www nginx 25663 25 tcp4 10.10.96.146:81 *:*<br>
www nginx 25662 25 tcp4 10.10.96.146:81 *:*<br>
www nginx 25661 25 tcp4 10.10.96.146:81 *:*<br>
www nginx 25660 25 tcp4 10.10.96.146:81 *:*<br>
www nginx 25659 25 tcp4 10.10.96.146:81 *:*<br>
www nginx 25658 25 tcp4 10.10.96.146:81 *:*<br>
www nginx 25657 25 tcp4 10.10.96.146:81 *:*<br>
www nginx 25656 25 tcp4 10.10.96.146:81 *:*<br>
www nginx 25655 25 tcp4 10.10.96.146:81 *:*<br>
www nginx 25654 25 tcp4 10.10.96.146:81 *:*<br>
www nginx 25653 25 tcp4 10.10.96.146:81 *:*<br>
www nginx 25652 25 tcp4 10.10.96.146:81 *:*<br>
www nginx 25651 25 tcp4 10.10.96.146:81 *:*<br>
root nginx 25650 25 tcp4 10.10.96.146:81 *:*<br>
<br>
ifconfig lo0<br>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu
16384<br>
options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6><br>
inet 127.0.0.1 netmask 0xffffffff<br>
<br>
So it looks like nginx is incorrectly binding which is resulting in
the issue with upgrade.<br>
<br>
Anyone seen this before?<br>
<br>
I've confirmed nginx is responding correctly on 127.0.0.1:<br>
lwp-request <a class="moz-txt-link-freetext" href="http://127.0.0.1:81/status">http://127.0.0.1:81/status</a> <br>
Active connections: 1077 <br>
server accepts handled requests<br>
31516 31516 90387 <br>
Reading: 0 Writing: 5 Waiting: 1071 <br>
<br>
Regards<br>
Steve<br>
</body>
</html>