Bug 919440

Summary: cronie: prevent new crond process when already running
Product: Red Hat Enterprise Linux 6 Reporter: Julien Thomas <julthomas>
Component: cronieAssignee: Marcela Mašláňová <mmaslano>
Status: CLOSED ERRATA QA Contact: qe-baseos-daemons
Severity: unspecified Docs Contact:
Priority: medium    
Version: 6.4CC: azelinka, jprokes, julthomas, markmurray
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: cronie-1.4.4-9.el6 Doc Type: Bug Fix
Doc Text:
Cause: Cron didn't check whether lock for daemon was already created. Consequence: More instances of crond could run. Fix: Better locking mechanism is used. Result: Only cron daemon at a time can run.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 22:24:35 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 Julien Thomas 2013-03-08 13:20:38 UTC
Description of problem:

In RHEL 6, we can start multiple instances of crond just by running command "crond" in a shell, even if the service is already running. Every cron job gets executed multiple times, function of the number of crond process running.

This is not necessarily a bug. Multiple instances were prevented on RHEL5 / vixie-cron (see additional info).

Version-Release number of selected component (if applicable):

cronie-1.4.4-7.el6.x86_64

How reproducible:

Always

Steps to Reproduce:
1. service crond is running from boot time
2. ps -ef |grep crond show the 1 instance running
3. as root, type crond in a shell
4. ps -ef |grep crond show the 2 instances running
  
Actual results:

Every job get executed multiple times.
This is function of the number of crond process.

Expected results:

It would be good to prevent running crond in a shell if the service is already started.

Additional info:

RHEL 5 (good behavior)
----------------------

[root@pom-demo-30 ~]$ rpm -qa |grep vixie-cron
vixie-cron-4.1-81.el5

1 crond process running :

[root@pom-demo-30 ~]# ps -ef |grep crond
root       474   445  0 13:55 pts/0    00:00:00 grep crond
root      2851     1  0  2012 ?        00:00:03 crond

Start of another crond process prevented :

[root@pom-demo-30 ~]# crond
crond: can't lock /var/run/crond.pid, otherpid may be 2851: Resource temporarily unavailable

Still 1 crond process :

[root@pom-demo-30 ~]# ps -ef |grep crond
root       548   445  0 13:55 pts/0    00:00:00 grep crond
root      2851     1  0  2012 ?        00:00:03 crond

RHEL 6
------

[root@pom302 ~]# rpm -qa |grep cronie
cronie-noanacron-1.4.4-7.el6.x86_64
cronie-1.4.4-7.el6.x86_64

1 crond process running :

[root@pom302 ~]# ps -ef |grep crond
root      1274     1  0 14:00 ?        00:00:00 crond
root      1885  1865  0 14:00 pts/0    00:00:00 grep crond

Start of another crond process is *not* prevented :

[root@pom302 ~]# crond
[root@pom302 ~]# 

[root@pom302 ~]# ps -ef |grep crond
root      1274     1  0 14:00 ?        00:00:00 crond
root      2010     1  0 14:00 ?        00:00:00 crond
root      2096  1865  0 14:00 pts/0    00:00:00 grep crond

Comment 2 Marcela Mašláňová 2013-03-29 12:23:28 UTC
Thank you for your report. That's really strange. Only one daemon should be running at time.

Comment 7 errata-xmlrpc 2013-11-21 22:24:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1681.html