Problem upgrading on the fly when ipv6 is used
Maxim Dounin
mdounin at mdounin.ru
Mon May 31 03:32:17 MSD 2010
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
-------------- next part --------------
# HG changeset patch
# User Maxim Dounin <mdounin at 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 "
More information about the nginx
mailing list