Dear Andrew,

i've looked into the problem and addressed it in the tip branch.
Here is my understanding: Background:

AOLserver supports just 2 types of signals, namely TERM and HUP

   #define NS_SIGTERM  1
   #define NS_SIGHUP   2

NaviServer has extended this to the following set of signals

   # define NS_SIGHUP                  1
   # define NS_SIGINT                  2
   # define NS_SIGQUIT                 3
   # define NS_SIGPIPE                13
   # define NS_SIGTERM                15

As far as i can see, everything is fine in NaviServer on the unix side.
However, this extension is/was not fully handled on the windows side.
Windows does not support sets of signals (sigset_t + supporting API),
so it uses an approach based on a global variable "sigpending",
in which incoming signals are or-ed together. Later the code
checks, whether the signal in question was fired (maybe among
other signals) by testing the bits:

         if ((sig & NS_SIGHUP)) {
             NsRunSignalProcs();
         }

This works fine, as long one has just distinct bits (like in
SIGTERM and SIGHUP in aolserver), but in NaviServer this
does not work. From the bit-patterns, SIGQUIT looks like SIGHUP
and SIGINT, one gets false positives on Ctr-c, which is handled
somewhat strangely via NS_SIGTERM from the ConsoleHandler(),
containing the HUP bit, rather than SIGINT.

I've changed the code by using distinct bit-patterns for signal
detection which should address the problem, but have just
checked that  the changes compile correctly under windows.
However, i've not located the code, where SIGHUP is handled
on the windows side. Andrew, how do you send SIGHUP to nsd?

-g


Am 28.10.14 01:05, schrieb Andrew Piskorski:
> At least on Windows (I have checked this behavior on Linux), when I
> start Naviserver in a Command Shell and then shut it down by hitting
> Ctrl-c, it rolls both the error and access logs (e.g. renaming
> "myserver-error.log" to "myserver-error.log.000").
>
> That's strange, and not what I expect or want.  I want to roll logs
> only at certain times of day, not every time I restart the server.
>
> That roll-on-shutdown behavior goes away if I set these parameters:
>
> ns_section ns/parameters
>    ns_param LogRoll false
> ns_section ns/server/my_server/module/nslog
>    ns_param RollOnSignal false
>
> But I expect that will interfere with scheduled log rolling as well.
> I WOULD like to roll the logs on SIGHUP, just not every time the
> server shuts down.  Any idea why the two seem to be conflated?
> Is Windows actually sending a HUP signal when I hit Ctrl-c?  (I don't
> THINK so.)  Or is Navisever somehow misinterpreting whatever Windows
> does as SIGHUP?
>
> This is a very minor problem but I do wonder just what is going on there.
>
> (Thanks!)
>

------------------------------------------------------------------------------
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to