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 2007/03/14 19:28:11 UTC

[Bug 5379] New: spamd doesn't start if /tmp/spamd-$pid-init exists

http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5379

           Summary: spamd doesn't start if /tmp/spamd-$pid-init exists
           Product: Spamassassin
           Version: 3.1.8
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P5
         Component: spamc/spamd
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: carletti@mobilia.it


At system startup I saw:
spamd: cannot create /tmp/spamd-1864-init: File exists at /usr/bin/spamd line 2144

$pid is always the same at startup and spamd doesn't start. Over time, I saw
this problem in three different systems, but I was unable to understand why the
init dir was left there. I always rm -rf spamd-%pid-init without further checks.

Looking at the code, it seems that there is a possibility that the dir is left
there in /tmp.
Wouldn't it be better to remove the dir if present on startup?



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

[Bug 5379] spamd doesn't start if /tmp/spamd-$pid-init exists

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





------- Additional Comments From parkerm@pobox.com  2007-04-02 07:19 -------
I don't think that fix goes far enough.

I've seen this fail when the directory gets its owner/group/permissions changed
out from under spamd.  Might need something that tries to remove and failing
that falls back to something else.



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

[Bug 5379] [review] spamd doesn't start if /tmp/spamd-$pid-init exists

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





------- Additional Comments From parkerm@pobox.com  2007-05-04 08:07 -------
In theory the dirs should be transient.

I do have a better question.  Do we even need them?  The only reason we create
them is to have compile_now and things it calls create a user_prefs file in
there while it preloads various modules into memory.  But do we really need to
do that?  Does that code path actually cause things to get loaded?  You can
specify no user prefs and the code won't try to create them anywhere.



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

[Bug 5379] [review] spamd doesn't start if /tmp/spamd-$pid-init exists

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





------- Additional Comments From parkerm@pobox.com  2007-05-03 09:35 -------
One thing I would worry about with that patch is what if, for some strange
reason, you've lost privs over those directories.  So when you go to try and
remove them you'll just die.  Next time you run you get lucky

Not an issue because you're root?  Admittedly, I'm not sure at what point we've
dropped privs here so maybe its a non-issue.



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

[Bug 5379] [review] spamd doesn't start if /tmp/spamd-$pid-init exists

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


jm@jmason.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|                            |needs 2 votes






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

[Bug 5379] spamd doesn't start if /tmp/spamd-$pid-init exists

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


carletti@mobilia.it changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|other                       |Linux






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

[Bug 5379] [review] spamd doesn't start if /tmp/spamd-$pid-init exists

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


sidney@sidney.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|needs 2 votes               |needs 1 vote




------- Additional Comments From sidney@sidney.com  2007-06-05 00:01 -------
Committed to trunk revision 544411

+1 for 3.2.1 branch

Needs one more vote for 3.2.1





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

[Bug 5379] [review] spamd doesn't start if /tmp/spamd-$pid-init exists

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


jm@jmason.org changed:

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




------- Additional Comments From jm@jmason.org  2007-06-06 13:50 -------
applied to 3.2.1:

: jm 5...; svn commit -m "bug 5379: spamd could crash at startup if its
preloading temporary directory already exists. fix" spamd/spamd.raw
Sending        spamd/spamd.raw
Transmitting file data .
Committed revision 544947.




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

[Bug 5379] [review] spamd doesn't start if /tmp/spamd-$pid-init exists

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


jm@jmason.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|spamd doesn't start if      |[review] spamd doesn't start
                   |/tmp/spamd-$pid-init exists |if /tmp/spamd-$pid-init
                   |                            |exists
  Status Whiteboard|deferable                   |
   Target Milestone|3.2.0                       |3.2.1




------- Additional Comments From jm@jmason.org  2007-05-03 04:56 -------
devs, please review for inclusion in 3.2.1...



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

[Bug 5379] spamd doesn't start if /tmp/spamd-$pid-init exists

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





------- Additional Comments From carletti@mobilia.it  2007-04-27 03:19 -------
It happened again and I found /tmp/spamd-nnnn-init/ containing an empty
.spamassassin directory.
I'll use this patch:
--- spamd.orig  2007-04-04 22:17:41.000000000 +0200
+++ spamd       2007-04-26 17:27:17.000000000 +0200
@@ -2141,6 +2141,8 @@
 
   dbg("spamd: Preloading modules with HOME=$tmphome");
 
+  rmdir( $tmpsadir ) or die "spamd: $tmpsadir not empty: $!";
+  rmdir( $tmphome ) or die "spamd: $tmphome not empty: $!";
   mkdir( $tmphome,  0700 ) or die "spamd: cannot create $tmphome: $!";
   mkdir( $tmpsadir, 0700 ) or die "spamd: cannot create $tmpsadir: $!";
   $ENV{HOME} = $tmphome;





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

[Bug 5379] spamd doesn't start if /tmp/spamd-$pid-init exists

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





------- Additional Comments From jm@jmason.org  2007-05-03 04:55 -------
Created an attachment (id=3932)
 --> (http://issues.apache.org/SpamAssassin/attachment.cgi?id=3932&action=view)
fix

here's that fix as a patch; it just fixes the simple case, not anything more
complex, though.



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

[Bug 5379] spamd doesn't start if /tmp/spamd-$pid-init exists

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


jm@jmason.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|                            |deferable
   Target Milestone|Undefined                   |3.2.0




------- Additional Comments From jm@jmason.org  2007-04-27 03:33 -------
I think something like that simple fix is ok to put into 3.2.1.



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

[Bug 5379] [review] spamd doesn't start if /tmp/spamd-$pid-init exists

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





------- Additional Comments From schulz@adi.com  2007-05-03 11:11 -------
I hope that I am not way off base here, but what happens if someone
accindently tries to start spamd when it is already running?  Will this
change allow the second spamd to remove files that the first one is using?



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

[Bug 5379] spamd doesn't start if /tmp/spamd-$pid-init exists

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





------- Additional Comments From carletti@mobilia.it  2007-04-02 06:34 -------
I'm now running with this small patch applied, but I failed to reproduce the error.

--- spamd.orig  2007-03-27 21:29:54.000000000 +0200
+++ spamd       2007-04-02 15:16:34.000000000 +0200
@@ -2141,6 +2141,7 @@

   dbg("spamd: Preloading modules with HOME=$tmphome");

+  rmdir( $tmphome ) or die "spamd: $tmphome not empty: $!";
   mkdir( $tmphome,  0700 ) or die "spamd: cannot create $tmphome: $!";
   mkdir( $tmpsadir, 0700 ) or die "spamd: cannot create $tmpsadir: $!";
   $ENV{HOME} = $tmphome;



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

[Bug 5379] [review] spamd doesn't start if /tmp/spamd-$pid-init exists

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





------- Additional Comments From jm@jmason.org  2007-05-04 08:18 -------
iirc, the problem is that Razor (and possibly others) tend to create/use files
in $HOME, and at that point we don't want razor data writing to root's $HOME
just to preload some modules.



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

[Bug 5379] [review] spamd doesn't start if /tmp/spamd-$pid-init exists

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


spamassassin@dostech.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|needs 1 vote                |go




------- Additional Comments From spamassassin@dostech.ca  2007-06-06 09:09 -------
+1



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