Bug 1126625

Summary: clamd should use Type=forking instead Type=simple
Product: [Fedora] Fedora Reporter: Harald Reindl <h.reindl>
Component: clamavAssignee: Sergio Basto <sergio>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 27CC: j, nathanael, nb, ondrejj, orion, redhat-bugzilla, sergio
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: clamav-0.99.2-18.fc27 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-01-25 07:15:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Harald Reindl 2014-08-04 21:49:49 UTC
Type=simple is completly un-trustable because it returns immediatly and the clamav-milter don't work if the clamd service is not available and don't recover which leads in temporary reject all messages by postfix 

3 options:

* fix the milter so it recovers if clamd is later ready for connections
* change clamd to Type=forking
* add a ExecStopPost which tests and waits until it is ready for connections

for option 3 you may look at the MariaDB/MySQL service

see also that bugreprot in conext of clamav
https://bugzilla.redhat.com/show_bug.cgi?id=1126595#c1

Comment 1 Harald Reindl 2014-08-04 21:55:06 UTC
that happens without type=forking and it is not necessary if Before/After are already ordered correctly

Aug  4 23:51:43 testserver clamav-milter[962]: ERROR: Failed to initiate streaming/fdpassing
Aug  4 23:51:43 testserver clamav-milter[962]: WARNING: No clamd server appears to be available

Comment 2 Fedora End Of Life 2015-05-29 12:33:46 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 Fedora End Of Life 2015-06-29 21:56:23 UTC
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 4 Sergio Basto 2018-01-08 23:58:38 UTC
(In reply to Harald Reindl from comment #0)
> Type=simple is completly un-trustable because it returns immediatly and the
> clamav-milter don't work if the clamd service is not available and don't
> recover which leads in temporary reject all messages by postfix 
> 
> 3 options:
> 
> * fix the milter so it recovers if clamd is later ready for connections
> * change clamd to Type=forking
> * add a ExecStopPost which tests and waits until it is ready for connections
> 
> for option 3 you may look at the MariaDB/MySQL service
> 
> see also that bugreprot in conext of clamav
> https://bugzilla.redhat.com/show_bug.cgi?id=1126595#c1

I changed clamd to Type=forking

Comment 5 Fedora Update System 2018-01-09 02:22:22 UTC
clamav-0.99.2-15.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-546d6f3abc

Comment 6 Fedora Update System 2018-01-09 17:44:02 UTC
clamav-0.99.2-15.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-546d6f3abc

Comment 7 Fedora Update System 2018-01-10 00:14:02 UTC
clamav-0.99.2-16.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-546d6f3abc

Comment 8 Fedora Update System 2018-01-10 16:13:00 UTC
clamav-0.99.2-16.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-546d6f3abc

Comment 9 Fedora Update System 2018-01-12 02:52:27 UTC
clamav-0.99.2-17.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-e5e5ec6ca2

Comment 10 Fedora Update System 2018-01-12 03:07:52 UTC
clamav-0.99.2-17.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-1713497ca1

Comment 11 Fedora Update System 2018-01-12 15:14:24 UTC
clamav-0.99.2-17.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-1713497ca1

Comment 12 Fedora Update System 2018-01-12 15:52:01 UTC
clamav-0.99.2-17.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-e5e5ec6ca2

Comment 13 Sergio Basto 2018-01-16 16:33:41 UTC
(In reply to Sergio Monteiro Basto from comment #4) 
> I changed clamd to Type=forking

Seems a regression see [1]

[1]
https://src.fedoraproject.org/rpms/clamav/c/8e91346cb14057357c325449041edea8df06b1e5?branch=master

Comment 14 Harald Reindl 2018-01-16 16:41:58 UTC
who is that idiot and why don't he read the fucking systemd manual?

https://www.freedesktop.org/software/systemd/man/systemd.service.html
If set to simple (the default if neither Type= nor BusName=, but ExecStart= are specified), it is expected that the process configured with ExecStart= is the main process of the service. In this mode, if the process offers functionality to other processes on the system, its communication channels should be installed before the daemon is started up (e.g. sockets set up by systemd, via socket activation), as systemd will immediately proceed starting follow-up units

how does that braindead fool imagine that services which use clamd smell that they have wait to start? and hence i overwride 99% of all unit-files in /etc/systemd/system/ because too many maintainers don't have the slightest clue what they are doing

Comment 15 Sergio Basto 2018-01-16 16:53:34 UTC
@Harald I really don't understand why your account aren't suspend yet , the author of commit is there , so don't insult him neither anyone, neither use offensive language , if not I will have to report you . 

I think is about : 
https://bodhi.fedoraproject.org/updates/clamav-0.99.2-17.fc27#comment-720009

Comment 16 Harald Reindl 2018-01-16 17:02:23 UTC
@Sergio - just because one guy did a override of the originally broken service which now needs to be corrected someone goes out and change the type back without any additional comment in bodhi?

frankly for many things i don't care about Fedora packages at all for years because when i override https://bodhi.fedoraproject.org/updates/clamav-0.99.2-17.fc27#comment-720009 can't happen because i cloe the whole unit in /etc/systemd/system or in most cases fork the whole packages because i am tired of such long response times and discussions at all

Comment 17 Harald Reindl 2018-01-16 17:05:58 UTC
the "--foreground=yes" is just plain wrong with Type=forking - that's it

don't get me wrong but i did expect a maintainer touching something to try if it works at all and then that won't have hapĆ¼pended - the proper fix anyways is "Type=forking" and remove "--foreground=yes" from ExecStart and not roll back to Type=simple

Comment 18 Harald Reindl 2018-01-16 17:08:40 UTC
that's BTW not clamd specific - "--foreground=yes" or similar called params disable the forking behavior from the daemon at start which is required by Type=simple

Comment 19 Orion Poplawski 2018-01-16 17:24:35 UTC
I'm fine with going back to Type=forking and removing --foreground=yes, I was just trying to fix it now starting with how it is configured.

Comment 20 Harald Reindl 2018-01-16 17:35:41 UTC
it's that simple for every unit out there:

Type=simple
ExecStart=binary --foreground=yes

Type=forking
ExecStart=binary --daemonize=yes

Comment 21 Sergio Basto 2018-01-17 16:40:55 UTC
/usr/sbin/clamd -c /etc/clamd.d/%i.conf --daemonize=yes

/usr/sbin/clamd: unrecognized option `--daemonize=yes'
ERROR: Unknown option passed
ERROR: Can't parse command line options

Comment 22 Sergio Basto 2018-01-17 17:17:23 UTC
Hi, thanks for the testing please can you edit again /usr/lib/systemd/system/clamd@.service and try with [1] and confirm that is working for you after run [2] , It seems that is working for me now. Thanks

[1]

[Unit]
Description = clamd scanner (%i) daemon
After = syslog.target nss-lookup.target network.target

[Service]
Type = forking
ExecStart = /usr/sbin/clamd -c /etc/clamd.d/%i.conf 
Restart = on-failure

[2]

systemctl daemon-reload 
systemctl start clamd

Comment 23 Orion Poplawski 2018-01-17 18:37:44 UTC
That works for me.  Presumably we should change clamav-milter.systemd to forking (and drop foreground=yes) for the same reason as well.  I've tested that as well as seems to work fine.

Comment 24 Sergio Basto 2018-01-17 21:06:07 UTC
OK thanks for testing and my sincere apologies for the bad behavior of Harald.
I'm going update package now , more 355 emails of spam o'matic (I'm fixing 9 bugs now)

Comment 25 Fedora Update System 2018-01-17 21:37:38 UTC
clamav-0.99.2-18.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-2a1f469c85

Comment 26 Fedora Update System 2018-01-17 21:40:19 UTC
clamav-0.99.2-18.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-11ba3bced1

Comment 27 Fedora Update System 2018-01-18 00:32:13 UTC
clamav-0.99.2-18.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-11ba3bced1

Comment 28 Fedora Update System 2018-01-18 02:12:22 UTC
clamav-0.99.2-18.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-2a1f469c85

Comment 29 Fedora Update System 2018-01-25 07:15:05 UTC
clamav-0.99.2-18.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.