New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken reload support? #367

Closed
jeffkaufman opened this Issue May 13, 2013 · 4 comments

Comments

Projects
None yet
2 participants
@jeffkaufman
Copy link
Contributor

jeffkaufman commented May 13, 2013

In this ngx_pagespeed installation guide it notes:

please note that whenever you modify the PageSpeed configuration, no matter if in the main nginx configuration or in a vhost, you must restart nginx - a simple reload does not work

I wrote to the author, who said:

nginx does not seem to take care of Pagespeed configuration changes when I run
/etc/init.d/nginx reload
whereas
/etc/init.d/nginx restart
seems to work. I'm not sure if the reload is sending a HUP to nginx though.

@oschaaf

This comment has been minimized.

Copy link
Member

oschaaf commented Jul 12, 2013

Testing this, nginx -s reload indeed is broken. Not only isn't it working, it leaves the worker process unable to handle new requests. Sending a few more reloads that way eventually leads up to the a segfault.

Looking in to it.

@ghost ghost assigned oschaaf Jul 12, 2013

@oschaaf

This comment has been minimized.

Copy link
Member

oschaaf commented Jul 12, 2013

The first thing I notice is that NgxRewriteOptions::Initialize() and NgxRewriteDriverFactory::Initialize() are called during the reload in the old worker process, which probably isn't going down well. I think I need to look at some older code, and check how this was wired back then. I remember reloading used to work fine.

@oschaaf

This comment has been minimized.

Copy link
Member

oschaaf commented Jul 12, 2013

The above happens when nginx.conf has disabled the use of a master process, in which case reloading isn't working at all. When configured to use a master process, reloading seems to be working most of the time - but I did manage to catch a segfault during a worker shutdown:

(gdb) bt
#0  0x0000000000000031 in ?? ()
#1  0x0000000000484ba9 in net_instaweb::RewriteDriverFactory::Deleter<net_instaweb::SerfUrlAsyncFetcher>::Run (
    this=<optimized out>) at ../ngx_pagespeed/psol/include/net/instaweb/rewriter/public/rewrite_driver_factory.h:475
#2  0x00000000006345d6 in net_instaweb::Function::CallRun (this=0x11cd150) at pagespeed/kernel/base/function.cc:51
#3  0x00000000004f65e9 in net_instaweb::RewriteDriverFactory::~RewriteDriverFactory (this=0x11c3980, 
    __in_chrg=<optimized out>) at net/instaweb/rewriter/rewrite_driver_factory.cc:147
#4  0x0000000000484a13 in ~SystemRewriteDriverFactory (this=0x11c3980, __in_chrg=<optimized out>)
    at ../ngx_pagespeed/psol/include/net/instaweb/system/public/system_rewrite_driver_factory.h:31
#5  net_instaweb::NgxRewriteDriverFactory::~NgxRewriteDriverFactory (this=0x11c3980, __in_chrg=<optimized out>)
    at ../ngx_pagespeed/src/ngx_rewrite_driver_factory.cc:111
#6  0x0000000000484abd in net_instaweb::NgxRewriteDriverFactory::~NgxRewriteDriverFactory (this=0x11c3980, 
    __in_chrg=<optimized out>) at ../ngx_pagespeed/src/ngx_rewrite_driver_factory.cc:117
#7  0x000000000047c287 in ngx_psol::(anonymous namespace)::ps_cleanup_srv_conf (data=<optimized out>)
    at ../ngx_pagespeed/src/ngx_pagespeed.cc:563
#8  0x000000000040e821 in ngx_destroy_pool (pool=0x11c8430) at src/core/ngx_palloc.c:55
#9  0x000000000042af07 in ngx_worker_process_exit (cycle=0x11c8480) at src/os/unix/ngx_process_cycle.c:1067
#10 0x000000000042b003 in ngx_worker_process_cycle (cycle=0x11c8480, data=<optimized out>)
    at src/os/unix/ngx_process_cycle.c:801
#11 0x00000000004297cb in ngx_spawn_process (cycle=0x11c8480, proc=0x42af3f <ngx_worker_process_cycle>, data=0x0, 
    name=0xbe8349 "worker process", respawn=-4) at src/os/unix/ngx_process.c:198
#12 0x000000000042a4d8 in ngx_start_worker_processes (cycle=0x11c8480, n=1, type=-4)
    at src/os/unix/ngx_process_cycle.c:362
#13 0x000000000042c074 in ngx_master_process_cycle (cycle=0x11c8480) at src/os/unix/ngx_process_cycle.c:249
#14 0x000000000040d718 in main (argc=<optimized out>, argv=<optimized out>) at src/core/nginx.c:412
@jeffkaufman

This comment has been minimized.

Copy link
Contributor

jeffkaufman commented Oct 22, 2013

Fixed by #439

dinic pushed a commit to dinic/ngx_pagespeed that referenced this issue Dec 19, 2013

shutdown: fix a crash when shutting down a worker process
Remove the deferred cleanup, as in ngx_pagespeed the fetcher
is owned by the RewriteDriverFactory.

Fixes the backtrace pointing to
net_instaweb::RewriteDriverFactory::Deleter
at apache#367

@pono pono unassigned oschaaf Jan 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment