Strange behavior with custom module and http proxy
piotr.sikora at frickle.com
Tue Dec 22 16:42:54 MSK 2009
> I have created a (very) small module that demonstrates the problem.
> It can be downloaded here:
1) This problem isn't related to caching at all, simple "proxy_pass"
also produces this behavior.
2) I believe that execv() is source of this problem, not fork().
Anyway, it seems that calling execv() with open sockets copies all file
descriptors to new process and nginx is expecting some action to happen
on them. Since there is no action, nginx waits until your process exits
(and OS closes all its file descriptors for you).
I've attached simple patch, which fixes this problem.
There are few things to consider:
1) This works well with kevent (*BSD), I'm not sure what will be the
effect of closing sockets registered with epoll (Linux), because when I
was developing ngx_slowfs_cache, nginx crashed when listening sockets
were closed after fork() under Linux.
2) This works as expected for single request. Under high load you might
need to close sockets for *all* requests... But I'm not really sure
about this and it's up to you to test this.
Piotr Sikora < piotr.sikora at frickle.com >
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the nginx