Welcome! Log In Create A New Profile

Advanced

Re: RE: RE: How to make nginx fail if it can't write to cache dir.

Francis Daly
February 01, 2022 03:48AM
On Sun, Jan 30, 2022 at 04:01:31AM -0500, unikron wrote:

Hi there,

> The error on a base dir is critical to all cache requests, so no request
> will succeed.

Yes. In your case, *all* requests are cache requests, so you want your
process to fail entirely. But in the general case, all of the non-cache
requests could be handled correctly while the administrator fixes their
cache-request configuration, so hard-failing is probably not appropriate
there.

> I know I can write a script to monitor it, but it seems like the wrong
> approach.
> I would like to have the option for nginx to stop if it can't do the job as
> should, But I guess that if no one answered with that kind of solution, it
> doesn't exist in nginx.

I believe that you are correct: stock nginx does not provide this
facility today.

If it is important to your use case, it should be possible for you to
modify your nginx source code to do the "stop the process entirely"
that you want.

For what it's worth: the log line that you showed seems to
only be possible when one of the functions: ngx_create_path() or
ngx_ext_rename_file() is called; and that does not happen in many places
in the source.

If you can (encourage someone to) modify the code to hard-exit when your
circumstances happen, then you will have a "quick fix" for your use case.

After that, maybe the change (controlled by some config option) would
be interesting to the wider project; in that case, you might not have
to maintain the change as an external patch that you apply-or-adapt to
every future nginx release that you want to use.

(I don't know if this particular facility could easily be provided by
an external module.)


In the main, at least one of the reasons why a facility does not exist
for general use, is that no-one has yet considered it important enough
to arrange that the code be written and shared.

You've found such a case that would be convenient for you if it already
existed; it doesn't; so you get to decide how important it is to you to
make it exist.

"Scripting around it" is a perfectly valid option too, of course. Others
exist as well, no doubt.

That probably isn't the answer that you want; but maybe it will help you
search for alternate solutions, once you know that the "easy" option is
not there.

Cheers,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-leave@nginx.org
Subject Author Posted

How to make nginx fail if it can't write to cache dir.

unikron January 27, 2022 06:07AM

RE: How to make nginx fail if it can't write to cache dir.

Reinis Rozitis January 27, 2022 06:44AM

Re: RE: How to make nginx fail if it can't write to cache dir.

unikron January 27, 2022 07:57AM

RE: RE: How to make nginx fail if it can't write to cache dir.

Reinis Rozitis January 27, 2022 09:14AM

Re: RE: RE: How to make nginx fail if it can't write to cache dir.

unikron January 30, 2022 04:01AM

Re: RE: RE: How to make nginx fail if it can't write to cache dir.

Francis Daly February 01, 2022 03:48AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 318
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