Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 507352 - mail-filter/amavisd-new - amavisd init script fails to restart when amavisd has abnormally terminated
Summary: mail-filter/amavisd-new - amavisd init script fails to restart when amavisd h...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Net-Mail Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-10 23:19 UTC by Robin Lutz
Modified: 2018-11-18 23:56 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch for old amavis.initd (amavisd.patch,160 bytes, patch)
2014-04-10 23:21 UTC, Robin Lutz
Details | Diff
unified patch (amavisd.initd.patch,517 bytes, patch)
2014-04-15 07:33 UTC, Robin Lutz
Details | Diff
amavisd.initd-r2 (amavisd.initd-r2,1.56 KB, text/plain)
2018-11-15 19:48 UTC, Michael Orlitzky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Lutz 2014-04-10 23:19:37 UTC
amavisd was terminated several times on our servers and an

/etc/init.d/amavisd restart

did not restart the process, because the pidfile was missing. I added a check for the PID file. See the patch.

The real problem is, that the command "/usr/sbin/amavisd stop" gives a return value >0, when amavisd was already stopped (which it should not IMHO). This is more or less a workaround for that.

You can also use "/etc/init.d/amavisd zap" to reset the init script state and then restart it.

Reproducible: Always

Steps to Reproduce:
1. install amavisd and start via /etc/init.d/amavisd
2. killall amavisd
3. try to restart with the init script
Actual Results:  
"/usr/sbin/amavisd stop" gives a return value >0 and the init system thinks there was a problem with stopping the daemon

Expected Results:  
the init script works anyway and the user is able to restart the service without doing "/etc/init.d/amavisd zap"
Comment 1 Robin Lutz 2014-04-10 23:21:51 UTC
Created attachment 374710 [details, diff]
Patch for old amavis.initd
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2014-04-11 17:06:33 UTC
Comment on attachment 374710 [details, diff]
Patch for old amavis.initd

Please attach unified diffs.
Comment 3 Robin Lutz 2014-04-15 07:33:57 UTC
Created attachment 374958 [details, diff]
unified patch
Comment 4 Robert R. Richter 2014-04-18 21:07:27 UTC
I don't know if my problem is related to yours, but I cannot stop or reload amavisd-new on two of my Gentoo boxes.

/etc/init.d/amavisd reload
 * Reloading amavisd-new ...
The amavisd daemon is not running

/etc/init.d/amavisd stop
 * Stopping amavisd-new ...
The amavisd daemon is not running
 * ERROR: amavisd failed to stop

BUT: amavisd-new is up and running !!
Comment 5 Robert R. Richter 2014-04-18 22:38:49 UTC
Plz forget my last comment - just found the 'bug'.

It seems that my system clock after boot has set to be 1 hour in the future. After setting the clock to 'normal' time, the amavis daemon is no longer able to stop or reload. However if I stop amavis before resetting my time and start it again, reload and stop seems to work...
Comment 6 Michael Orlitzky gentoo-dev 2018-11-15 19:48:02 UTC
Created attachment 555284 [details]
amavisd.initd-r2

I have a new init script that I think fixes this. I'm going to commit it after I test for a while, along with version bump for amavisd-new itself. I would be interesting in hearing if this solves your problem (I think it does).
Comment 7 Nick Wiltshire 2018-11-15 21:26:15 UTC
I just tested this on our setup, and it does indeed seem to fix this bug as well as #646336 based on testing by killing the master amavis service. With the current mainline init it will show as running in rc-status and refuse to restart until zapped.

After switching to the new init script, these behaviours are corrected.
Comment 8 Larry the Git Cow gentoo-dev 2018-11-18 23:56:40 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8fe3982751aa4881b42f89ed080b210c4529c81

commit c8fe3982751aa4881b42f89ed080b210c4529c81
Author:     Michael Orlitzky <mjo@gentoo.org>
AuthorDate: 2018-11-17 15:09:21 +0000
Commit:     Michael Orlitzky <mjo@gentoo.org>
CommitDate: 2018-11-18 23:23:57 +0000

    mail-filter/amavisd-new: new version 2.11.1.
    
    A mostly standard version bump (bug 668494) with some improvements and
    bug fixes piled on:
    
      * The sys-apps/file dependency is replaced by dev-perl/File-LibMagic
        to improve performance a bit (bug 592802).
    
      * New user creation has been moved to pkg_setup(). This allows us to
        set permissions and ownership properly in src_install(), so that
        we don't have to "fix" them later and cause big ol' security
        problems (bug 630836).
    
      * The OpenRC service script has been rewritten to use start-stop-daemon.
        This fixes outstanding bugs 507352, 634860, and 646336.
    
      * The systemd service dependencies have been updated (bug 581452). We
        never really needed spamassassin (spamd) at all, and we shouldn't fail
        to start if postfix/clamav are absent entirely.
    
      * As part of the previous item, removed two failing "sed" calls
        (that were missing die() statements!) intended to modify a service
        file that no longer lives where it used to.
    
    Thanks are due to,
    
      * Marcin Mirosław who reported an OpenRC issue,
      * Nick Wiltshire for reporting and testing the OpenRC fixes,
      * Robin Lutz for reporting the OpenRC restart issue,
      * Timo Rothenpieler for reporting the systemd dependency issue.
    
    Bug: https://bugs.gentoo.org/630836
    Closes: https://bugs.gentoo.org/507352
    Closes: https://bugs.gentoo.org/581452
    Closes: https://bugs.gentoo.org/592802
    Closes: https://bugs.gentoo.org/634860
    Closes: https://bugs.gentoo.org/646336
    Closes: https://bugs.gentoo.org/668494
    Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
    Package-Manager: Portage-2.3.51, Repoman-2.3.11

 mail-filter/amavisd-new/Manifest                   |  1 +
 ...-2.11.0-r4.ebuild => amavisd-new-2.11.1.ebuild} | 68 ++++++++++++----------
 mail-filter/amavisd-new/files/amavisd.initd-r2     | 42 +++++++++++++
 mail-filter/amavisd-new/files/amavisd.service-r1   | 21 +++++++
 4 files changed, 101 insertions(+), 31 deletions(-)