You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@spamassassin.apache.org on 2022/08/31 14:05:47 UTC

[Bug 8036] New: reload messes up pc -C $0

https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8036

            Bug ID: 8036
           Summary: reload messes up pc -C $0
           Product: Spamassassin
           Version: 4.0.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: spamc/spamd
          Assignee: dev@spamassassin.apache.org
          Reporter: uhlar@fantomas.sk
  Target Milestone: Undefined

after reloading spamd, the "spamd" process is lost from ps -e and ps -C
listing.
While the fix for Bug 7594 works at spamd start, it won't work after reload.

# /etc/init.d/spamd start
Starting SpamAssassin Mail Filter Daemon: spamd.
# ps -e | grep spamd
18642 ?        00:00:04 spamd
18649 ?        00:00:00 spamd child
18650 ?        00:00:00 spamd child
# ps -ef | grep spamd
root     18642     1 32 15:33 ?        00:00:04 /usr/bin/perl -T -w
/usr/sbin/spamd --max-children 4 --helper-home-dir --default-user=abuse -d
--pidfile=/var/run/spamd.pid
root     18649 18642  0 15:33 ?        00:00:00 spamd child
root     18650 18642  0 15:33 ?        00:00:00 spamd child
root     18654 15319  0 15:33 pts/6    00:00:00 grep spamd
# ps -C spamd
  PID TTY          TIME CMD
18642 ?        00:00:04 spamd
# kill -HUP 18642
# ps -e | grep spamd
18679 ?        00:00:00 spamd child
18680 ?        00:00:00 spamd child
# ps -ef | grep spamd
root     18673     1 37 15:34 ?        00:00:04 /usr/bin/perl -T -w -I
/etc/perl -I /usr/lib/i386-linux-gnu/perl5/5.32 -I /usr/share/perl5 -I
/usr/lib/i386-linux-gnu/perl-base -I /usr/lib/i386-linux-gnu/perl/5.32 -I
/usr/share/perl/5.32 /usr/sbin/spamd --max-children 4 --helper-home-dir
--default-user=abuse -d --pidfile=/var/run/spamd.pid
root     18679 18673  0 15:34 ?        00:00:00 spamd child
root     18680 18673  0 15:34 ?        00:00:00 spamd child
root     18684 15319  0 15:34 pts/6    00:00:00 grep spamd
# ps -C spamd
  PID TTY          TIME CMD

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8036] reload messes up pc -C $0

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8036

Sidney Markowitz <si...@sidney.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sidney@sidney.com

--- Comment #2 from Sidney Markowitz <si...@sidney.com> ---
I've got a simple fix for this, Will post a patch after I finish testing.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8036] [REVIEW] reload messes up ps -C $0

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8036

Matus UHLAR - fantomas <uh...@fantomas.sk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uhlar@fantomas.sk

--- Comment #5 from Matus UHLAR - fantomas <uh...@fantomas.sk> ---
(In reply to Sidney Markowitz from comment #3)
> Created attachment 5806 [details]
> proposed patch to set $0 so ps -C spamd works

> This patch reinstates the setting of $0 before daemonizing, just like what
> was removed in the fix for bug 7594, but hardcodes it to just 'spamd'
> instead.

I can confirm this works as required on my debian 11/gnu linux installation

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8036] reload messes up pc -C $0

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8036

Sidney Markowitz <si...@sidney.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|Undefined                   |4.0.0

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8036] [REVIEW] reload messes up ps -C $0

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8036

Sidney Markowitz <si...@sidney.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[REVIEW] reload messes up   |[REVIEW] reload messes up
                   |pc -C $0                    |ps -C $0

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8036] [REVIEW] reload messes up ps -C $0

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8036

Henrik Krohns <ap...@hege.li> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |apache@hege.li

--- Comment #8 from Henrik Krohns <ap...@hege.li> ---
I really dislike all the process name mangling, masking all the arguments, -I
additions and different handling when debug is enabled. Don't have any better
suggestions though, so I'm +-0. There's enough votes anyway.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8036] [REVIEW] reload messes up ps -C $0

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8036

--- Comment #6 from Kevin A. McGrail <km...@apache.org> ---
+1 from me.  My scripts with ps work fine too.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8036] [REVIEW] reload messes up pc -C $0

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8036

Sidney Markowitz <si...@sidney.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|reload messes up pc -C $0   |[REVIEW] reload messes up
                   |                            |pc -C $0

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8036] reload messes up pc -C $0

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8036

--- Comment #3 from Sidney Markowitz <si...@sidney.com> ---
Created attachment 5806
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5806&action=edit
proposed patch to set $0 so ps -C spamd works

I at first tried to fix it in the exec call, but ps on linux seems to not use
the program name that is set there for the comm name that is uses in ps -C

Since bug 7594 showed that setting $0 messed up ps -C I tried fixing this by
setting $0 to something that works. perldoc on $0 says that it sets the legacy
ps name which on linux is truncated to 15 characters. That truncation was the
underlying cause of the problem in bug 7594.

This patch reinstates the setting of $0 before daemonizing, just like what was
removed in the fix for bug 7594, but hardcodes it to just 'spamd' instead. Like
it was there, it is not done if debug logging is on and it is only done for
daemonized processes. Note that this will set it to 'spamd' even if the spamd
script file is renamed to something else. I don't think we need to handle it
differently in the case of the script file being renamed.

Please test and vote. I only tested on Linux so far, probably would be a good
idea to check the behavior on a BSD.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8036] [REVIEW] reload messes up ps -C $0

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8036

Sidney Markowitz <si...@sidney.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #10 from Sidney Markowitz <si...@sidney.com> ---
trunk % svn ci -m "bug 8036 - set $0 so ps -C spamd works on linux"
spamd/spamd.raw
Sending        spamd/spamd.raw
Transmitting file data .done
Committing transaction...
Committed revision 1903904.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8036] [REVIEW] reload messes up ps -C $0

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8036

--- Comment #9 from Matus UHLAR - fantomas <uh...@fantomas.sk> ---
(In reply to Henrik Krohns from comment #8)
> I really dislike all the process name mangling, masking all the arguments,
> -I additions and different handling when debug is enabled. Don't have any
> better suggestions though, so I'm +-0. There's enough votes anyway.

while I agree and parameters should be visible in full list (ps -ef), this is
all we have for now.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8036] reload messes up pc -C $0

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8036

Kevin A. McGrail <km...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |blocker
                 CC|                            |kmcgrail@apache.org

--- Comment #1 from Kevin A. McGrail <km...@apache.org> ---
First step, Moving this to a blocker for 4.0.0 release

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8036] reload messes up pc -C $0

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8036

--- Comment #4 from Sidney Markowitz <si...@sidney.com> ---
I tested on FreeBSD. The ps and the way processes are represented are
different, so there isn't something like ps -C spamd that would be expected to
work. But the change in the behavior with the patch doesn't seem to break
anything and may be mildly more useful than without it. More combinations of
options in ps show "spamd" with the patch than without it.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8036] [REVIEW] reload messes up ps -C $0

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8036

Bill Cole <bi...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |billcole@apache.org

--- Comment #7 from Bill Cole <bi...@apache.org> ---
+1

-- 
You are receiving this mail because:
You are the assignee for the bug.