Maxim Dounin
May 30, 2010 07:40PM
Hello!

On Sat, May 29, 2010 at 03:23:54AM -0400, Usu wrote:

> I've always upgraded nginx on the fly following this guide:
> http://wiki.nginx.org/NginxCommandLine without problems.
> I recently added IPv6 support to nginx and now, when I need to
> upgrade it, it doesn't start the new instance when I send the
> USR2 signal to the master process, giving the following erros:
> [code]
> 2010/05/29 09:05:52 [notice] 21060#0: using inherited sockets from "14;15;"
> 2010/05/29 09:05:52 [emerg] 21060#0: bind() to [2001:41d0:2:8673::1]:80 failed (98: Address already in use)
> [emerg]: bind() to [2001:41d0:2:8673::1]:80 failed (98: Address already in use)

[...]

Attached patch should resolve this issue.

Maxim Dounin
# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1275262166 -14400
# Node ID 478595e4115aecc70c7c9ddd2f455908dc4c2542
# Parent 7cbc7affef15fa626886f4ae35fc80916ab0ce21
Handle not only AF_INET inherited sockets.

diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -96,14 +96,12 @@ ngx_set_inherited_sockets(ngx_cycle_t *c
ls = cycle->listening.elts;
for (i = 0; i < cycle->listening.nelts; i++) {

- /* AF_INET only */
-
- ls[i].sockaddr = ngx_palloc(cycle->pool, sizeof(struct sockaddr_in));
+ ls[i].sockaddr = ngx_palloc(cycle->pool, NGX_SOCKADDRLEN);
if (ls[i].sockaddr == NULL) {
return NGX_ERROR;
}

- ls[i].socklen = sizeof(struct sockaddr_in);
+ ls[i].socklen = NGX_SOCKADDRLEN;
if (getsockname(ls[i].fd, ls[i].sockaddr, &ls[i].socklen) == -1) {
ngx_log_error(NGX_LOG_CRIT, cycle->log, ngx_socket_errno,
"getsockname() of the inherited "
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Problem upgrading on the fly when ipv6 is used

Usu May 29, 2010 03:23AM

Re: Problem upgrading on the fly when ipv6 is used

Maxim Dounin May 30, 2010 07:40PM

Re: Problem upgrading on the fly when ipv6 is used

Usu May 31, 2010 03:57AM

Re: Problem upgrading on the fly when ipv6 is used

Maxim Dounin May 31, 2010 04:20AM

Re: Problem upgrading on the fly when ipv6 is used

Usu May 31, 2010 07:53AM

Re: Problem upgrading on the fly when ipv6 is used

Maxim Dounin May 31, 2010 09:16AM

Re: Problem upgrading on the fly when ipv6 is used

Igor Sysoev May 31, 2010 10:44AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 291
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready