2

I'm running nginx 1.9.3. When downloading a large file (in this case, 1GiB), and reloading nginx via "nginx -s reload", the download gets interrupted in numerous browsers, including (but potentially not limited to), Opera, Google Chrome, and Firefox.

With curl and standard flags (no extra headers, just the file URL), the download works fine, and is not interrupted.

server {
    listen 443 ssl spdy;
    include tls.conf;
    server_name example.com;

    root /var/www/dl;

    access_log logs/dl.access.log;
    error_log logs/dl.error.log;

    error_page 403 https://example.com;
}

As I understand it, the nginx processes should wait for any requests to complete before terminating themselves, so I'm not entirely sure why this is happening. If anyone could supply my brain with the extra knowledge or point me to some relevant directives in the nginx documentation, I would love to get this fixed. :-)

1
  • Just for an experiment, How does nginx change its behavior when keep-alive is disabled? (Add keepalive_timeout 0;) Commented Aug 5, 2015 at 15:26

1 Answer 1

2

Read this nginx doc. You need to perform graceful restart instead of reload. Simple reload doesn't gracefully restart worker processes.

The graceful restart would be the following steps:

kill -USR2 $(cat /var/run/nginx.pid)
kill -WINCH $(cat /var/run/nginx.pid.oldbin)
kill -QUIT $(cat /var/run/nginx.pid.oldbin)

EDIT: Well, the doc actually reads:

HUP changing configuration, keeping up with a changed time zone (only for FreeBSD and Linux), starting new worker processes with a new configuration, graceful shutdown of old worker processes

So just kill -HUP $(cat /var/run/nginx.pid) would suffice and nginx -s reload seems to do the same... There would be different causes for your problem.

1
  • Thanks for replying. Indeed, I tried sending the HUP signal to do a graceful restart but the download was still interrupted. It's not too bad because I can resume the download, I just don't want to annoy users when changing config. :-) Commented Aug 5, 2015 at 16:14

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.