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...@bugzilla.spamassassin.org on 2011/05/28 05:21:16 UTC

[Bug 6606] New: spamd does not be daemonized on Perl 5.14.0

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

             Bug #: 6606
           Summary: spamd does not be daemonized on Perl 5.14.0
           Product: Spamassassin
           Version: 3.3.2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: spamc/spamd
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: shanwill44@yahoo.com
    Classification: Unclassified


It seems spamd does not be daemonized on Perl 5.14.0 correctly.
It should have been "spamd" instead of "/usr/local/bin/spamd" on Perl 5.12.x.

$ ps -ef | grep spamd
spamd    15573 18196  1 11:13 ?        00:00:38 spamd child
spamd    15576 18196  0 11:13 ?        00:00:20 spamd child
root     18196     1  0 03:31 ?        00:00:02 /usr/local/bin/spamd -u spamd
-d --max-children=20

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6606] spamd process name assignment ($0) bad on Perl 5.14.0

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

--- Comment #10 from Kevin A. McGrail <km...@pccc.com> 2011-05-29 19:10:24 UTC ---
(In reply to comment #9)
> (In reply to comment #8)
> > This doesn't really sounds like a spamd bug so much as a perl bug. It's
> > possible nobody is even aware of it. I would encourage you to inquire to perl 5
> > porters about this:
> > 
> > perl5-porters@perl.org
> 
> As noted above, I think it might be expected behavior as I see it on my system
> with 5.8.8.  Perhaps it is on purpose when you use multiple version of perl on
> the same system but I disagree this is a valid bug in SA.

Just following up that if this is a "bug", it's not recent.  Here is perl 5.8.8
on a system with SA 3.3.0 exhibiting the same behavior.

root     30515  0.0  0.0  46108  3620 ?        Ss   May26   1:28
/usr/local/bin/spamd -d --min-spare=1 --min-children=5 --max-spare=10
--max-conn-per-child=1000 --max-children=20 -q -x -u spamd

Regards,
KAM

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6606] spamd does not be daemonized on Perl 5.14.0

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

shanwill44@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |shanwill44@yahoo.com

--- Comment #2 from shanwill44@yahoo.com 2011-05-28 04:37:45 UTC ---
spamd used be killed by "pkill spamd",
but not now on Perl 5.14.0.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6606] spamd process name assignment ($0) bad on Perl 5.14.0

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

--- Comment #12 from Kevin A. McGrail <km...@pccc.com> 2011-05-29 20:01:26 UTC ---
(In reply to comment #11)
> I think the main point of this bug is:
> 
> - Spamd sets $0 to "/usr/local/bin/spamd -x -y -z"
> - Perl 5.14 uses prctl, which truncates this to "/usr/local/bin/s" or so (16
> chars limit)
> - Thus I think pkill might not work if you use Perl 5.14
> 
> Just quick speculation without testing. But sounds logical.

Definitely logical but this is a perl/admin issue not a bug in SA, IMO.

The right answer is an init script for my $0.02.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6606] spamd does not be daemonized on Perl 5.14.0

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

Darxus <Da...@ChaosReigns.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Darxus@ChaosReigns.com

--- Comment #1 from Darxus <Da...@ChaosReigns.com> 2011-05-28 03:34:38 UTC ---
What?

I don't see anything wrong with that ps output.  I get something very similar
with an older perl.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6606] spamd does not be daemonized on Perl 5.14.0

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

--- Comment #5 from Darxus <Da...@ChaosReigns.com> 2011-05-28 14:58:40 UTC ---
Shan, I do appreciate you taking the time to report this bug, it's just that
open source projects can be funny the way they're driven more by how much
active developers care about each issue than anything else.

I certainly understand that can be incredibly frustrating.

If you can provide an explanation of what exactly pkill needs to work, or what
spamassassin is doing wrong, it might increase the chances of this getting
fixed.

And of course, you could always submit a patch yourself.  No better way to
learn how to program.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6606] spamd process name assignment ($0) bad on Perl 5.14.0

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

--- Comment #9 from Kevin A. McGrail <km...@pccc.com> 2011-05-29 19:04:57 UTC ---
(In reply to comment #8)
> This doesn't really sounds like a spamd bug so much as a perl bug. It's
> possible nobody is even aware of it. I would encourage you to inquire to perl 5
> porters about this:
> 
> perl5-porters@perl.org

As noted above, I think it might be expected behavior as I see it on my system
with 5.8.8.  Perhaps it is on purpose when you use multiple version of perl on
the same system but I disagree this is a valid bug in SA.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6606] spamd process name assignment ($0) bad on Perl 5.14.0

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

Todd Rinaldo <to...@cpanel.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |toddr@cpanel.net

--- Comment #8 from Todd Rinaldo <to...@cpanel.net> 2011-05-29 18:50:03 UTC ---
This doesn't really sounds like a spamd bug so much as a perl bug. It's
possible nobody is even aware of it. I would encourage you to inquire to perl 5
porters about this:

perl5-porters@perl.org

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6606] spamd process name assignment ($0) bad on Perl 5.14.0

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

--- Comment #13 from Darxus <Da...@ChaosReigns.com> 2011-05-29 22:04:11 UTC ---
Created attachment 4911
  --> https://issues.apache.org/SpamAssassin/attachment.cgi?id=4911
Patch - not tested

What's the point in arguing over whether this is a bug in spamd or not when a
fix is so simple?

This patch just changes the process name from "/path/to/spamd -args" to "spamd
-args".  The reverse(split()) stuff looks kind of complicated, but it's just
stripping off the path.  File::Basename would be more readable, but I think not
worth loading another module.

The patch just replaces $ORIG_ARG0 with:
(reverse(split('/',$ORIG_ARG0)))[0]

Or you could hard code it and just replace $ORIG_ARG0 with 'spamd' (which it
will probably always end up being anyway), as is done for the children.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6606] spamd does not be daemonized on Perl 5.14.0

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

Kevin A. McGrail <km...@pccc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |kmcgrail@pccc.com
         Resolution|                            |INVALID

--- Comment #3 from Kevin A. McGrail <km...@pccc.com> 2011-05-28 08:15:52 UTC ---
This is how perl 5.8.8 works for me on one of my production system.  Recommend
you create/use an init-esque script for starting/stopping spamd.  Using pkill
is not exactly something I can see the SA project worrying about.

root     30515  0.0  0.0  46108  3620 ?        Ss   May26   0:46
/usr/local/bin/spamd -d --min-spare=1 --min-children=5 --max-spare=10
--max-conn-per-child=1000 --max-children=20 -q -x -u spamd
spamd    30565  0.0  0.0  46036  3048 ?        S    May26   0:00 spamd child
spamd    30566  0.0  0.0  46044  3032 ?        S    May26   0:00 spamd child
spamd    30568  0.0  0.0  46052  3056 ?        S    May26   0:00 spamd child
spamd    30570  0.0  0.0  46060  3044 ?        S    May26   0:00 spamd child
spamd    30571  0.0  0.0  46068  3028 ?        S    May26   0:00 spamd child
spamd    30572  0.0  0.0  46076  3052 ?        S    May26   0:00 spamd child
spamd    30573  0.0  0.0  46084  3064 ?        S    May26   0:00 spamd child
spamd    30574  0.0  0.0  46092  3072 ?        S    May26   0:00 spamd child
spamd    30575  0.0  0.0  46100  3048 ?        S    May26   0:00 spamd child
spamd    30576  0.0  0.0  46108  3024 ?        S    May26   0:00 spamd child
root     17116  0.0  0.0   1740   596 pts/0    S+   04:14   0:00 grep spamd

Regards,
KAM

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6606] spamd does not be daemonized on Perl 5.14.0

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

--- Comment #6 from shanwill44@yahoo.com 2011-05-29 01:23:53 UTC ---
Darxus,

Thank you for the encouraging message.
When "ps -al", all daemons other than spamd shows up as

1 S    51 22689     1  0  75   0 - 97029 ?      ?        00:00:17 clamd
5 S    99 24753 30281  0  75   0 - 26814 semtim ?        00:00:00 httpd
4 S     0 24873  2368  0  75   0 -  5469 ?      ?        00:00:00 imapd
......
(No full path)

but

5 S     0 22683     1  0  75   0 - 56586 ?      ?        00:00:02
/usr/local/bin/

which should be the truncated from /usr/local/bin/spamd.
Something seemed to be wrong, but I cannot say anymore from
technical point of view. I will change to use init.d script anyway.
Thank you again for your help.

shan

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6606] spamd process name assignment ($0) bad on Perl 5.14.0

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

--- Comment #11 from Henrik Krohns <he...@hege.li> 2011-05-29 19:19:17 UTC ---

I think the main point of this bug is:

- Spamd sets $0 to "/usr/local/bin/spamd -x -y -z"
- Perl 5.14 uses prctl, which truncates this to "/usr/local/bin/s" or so (16
chars limit)
- Thus I think pkill might not work if you use Perl 5.14

Just quick speculation without testing. But sounds logical.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6606] spamd process name assignment ($0) bad on Perl 5.14.0

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

--- Comment #14 from Kevin A. McGrail <km...@pccc.com> 2011-05-29 22:12:21 UTC ---
(In reply to comment #13)=
> What's the point in arguing over whether this is a bug in spamd or not when a
> fix is so simple?

Because a "fix" to one person is a bug to another.  We chose to put the full
path and pretty up the ps display on purpose.  

I mean, an init script is the correct way to stop/start a daemon on most modern
*nixes.

If not, wouldn't pgrep/pkill -f spamd solve his issue?  

In the end, I personally LIKE to see what perl is executing the spamd since I
have multiple perl's installed in parallel for testing, etc.

At worst, we could compromise and you could add a command-line parameter to
spamd for the issue.  Something like --short-ps.

Regards,
KAM

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6606] spamd process name assignment ($0) bad on Perl 5.14.0

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

Kevin A. McGrail <km...@pccc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID

--- Comment #15 from Kevin A. McGrail <km...@pccc.com> 2012-01-17 18:27:50 UTC ---
This isn't an SA bug.  The code is purposefully doing this.  Patch to change
behavior not accepted.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6606] spamd does not be daemonized on Perl 5.14.0

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

--- Comment #4 from shanwill44@yahoo.com 2011-05-28 09:04:47 UTC ---
KAM,

Thank you for your explanation, and sorry for bothering you to write down a
long reply.

shan

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6606] spamd process name assignment ($0) bad on Perl 5.14.0

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6606

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |hege@hege.li
         Resolution|INVALID                     |
   Target Milestone|Undefined                   |3.3.2
            Summary|spamd does not be           |spamd process name
                   |daemonized on Perl 5.14.0   |assignment ($0) bad on Perl
                   |                            |5.14.0

--- Comment #7 from Henrik Krohns <he...@hege.li> 2011-05-29 05:56:54 UTC ---
>From Perl 5.14 changelog:

=========
Assignment to $0 sets the legacy process name with prctl() on Linux

On Linux the legacy process name is now set with prctl(2), in addition to
altering the POSIX name via argv[0], as Perl has done since version 4.000. Now
system utilities that read the legacy process name such as ps, top, and killall
recognize the name you set when assigning to $0. The string you supply is
truncated at 16 bytes; this limitation is imposed by Linux.
=========

It seems we need to either forget setting $0 on 5.14 or set it at something
short. This is just stupid.. no time to think about the best fix right now.

Changed topic to reflect bug.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.