bug-gzip
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15380: Bug in gzip.c buffering, and two feature requests


From: Martin Langhoff
Subject: bug#15380: Bug in gzip.c buffering, and two feature requests
Date: Sun, 15 Sep 2013 09:36:15 -0400

On Sun, Sep 15, 2013 at 12:13 AM, Paul Eggert <address@hidden> wrote:
> Your gzip feature requests sound reasonable, except for this one:

Thanks for taking the time to reply!

>> Bug: gzip.c discards its buffers when it gets SIGTERM, with no
>> effort made to flush them to disk.
>
> That's the normal behavior of utilites when they get SIGTERM; they
> exit right away with minimal fuss, and they typically do not attempt
> to flush output buffers.

I am no POSIX lawyer. Googling, I find two diverging interpretations
of SIGTERM -- one is close to SIGABRT, the other one is for a more
elegant exit.

For example, Wikipedia has:

"SIGTERM - The SIGTERM signal is sent to a process to request its
termination. Unlike the SIGKILL signal, it can be caught and
interpreted or ignored by the process. This allows the process to
perform nice termination releasing resources and saving state if
appropriate. It should be noted that SIGINT is nearly identical to
SIGTERM."

Did a bit of reading around POSIX 2008 at
http://pubs.opengroup.org/onlinepubs/9699919799/ -- if I read
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html
I do find that SIGTERM should behave as per the "T" key, "Abnormal
termination of process". But it also says SIGALRM, SIGUSR1 and SIGUSR2
are "T", so this is not the information we are looking for :-)

At the end of the day, we didn't get SIGABRT. We got SIGTERM. IMHO,
flushing of buffers is reasonable in this context.

>> Logging via gzip adds buffering, when apache is stopped (or
>> restarted, usually daily to rotate logs), apache sends SIGTERM
>> before it closes the fh;
>
> That seems wrong.  Apache should close the file handle, and let gzip
> finish up cleanly.  Maybe Apache should kill gzip if gzip doesn't exit

I am double-checking the apache sources to confirm my initial reading,
but TBH I am not yet convinced that SIGTERM is wrong in this context.
(closing the fh would be nice, though).

cheers,



m
-- 
 address@hidden
 -  ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 ~ http://docs.moodle.org/en/User:Martin_Langhoff





reply via email to

[Prev in Thread] Current Thread [Next in Thread]