Bug 644302

Summary: service cumin can be started more than once
Product: Red Hat Enterprise MRG Reporter: Lubos Trilety <ltrilety>
Component: cuminAssignee: Trevor McKay <tmckay>
Status: CLOSED ERRATA QA Contact: Jan Sarenik <jsarenik>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.3CC: jsarenik, matt
Target Milestone: 2.0Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: cumin-0.1.4519-2.el5 Doc Type: Bug Fix
Doc Text:
Cause The /etc/init.d/cumin script does not check to see if the cumin service is already running before starting another instance of the service when the /sbin/service cumin start command is issued. Consequence It is possible to unintentionally run multiple instances of cumin with new instances failing if they try to bind to the same port or succeeding if they use different ports. This will consume extra resources and log files will be interleaved. Fix The /etc/init.d/cumin script checks to see if the cumin service is already running before starting an instance of the service. Result If the service is already running, the script reports success and exits. If it is not, a new instance is started.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-23 15:40:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 693778    

Description Lubos Trilety 2010-10-19 11:40:13 UTC
Description of problem:
Cumin init.d script allow to run more than one cumin.

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

How reproducible:
100%

Steps to Reproduce:
1. run 'service cumin start'
# service cumin start
Starting cumin: [  OK  ]

2. run 'service cumin start' again and wait about 30 seconds
# service cumin start
Starting cumin: [  OK  ]
[root@host ~]# Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.4/threading.py", line 442, in __bootstrap
    self.run()
  File "/usr/share/cumin/python/wooly/server.py", line 213, in run
    self.wsgi_server.start()
  File "/usr/share/cumin/python/wooly/wsgiserver/__init__.py", line 1660, in start
    raise socket.error(msg)
error: (98, 'Address already in use')

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.4/threading.py", line 442, in __bootstrap
    self.run()
  File "/usr/share/cumin/python/mint/update.py", line 52, in run
    update.process(self)
  File "/usr/share/cumin/python/mint/update.py", line 194, in process
    except UpdateException, e:
NameError: global name 'UpdateException' is not defined

  
Actual results:
both cumin are running, error appears
# ps -eaf | grep cumin
cumin    14445     1  0 07:33 ?        00:00:00 /bin/bash /usr/bin/cumin
cumin    14446 14445  2 07:33 ?        00:00:02 /usr/bin/python /usr/bin/cumin-data
cumin    14448 14445  2 07:33 ?        00:00:01 /usr/bin/python /usr/bin/cumin-web
postgres 14451 13540  0 07:33 ?        00:00:00 postgres: cumin cumin 127.0.0.1(59873) idle in transaction
cumin    14583     1  0 07:33 ?        00:00:00 /bin/bash /usr/bin/cumin
cumin    14584 14583  3 07:33 ?        00:00:02 /usr/bin/python /usr/bin/cumin-data
cumin    14585 14583  2 07:33 ?        00:00:01 /usr/bin/python /usr/bin/cumin-web
postgres 14589 13540  0 07:33 ?        00:00:00 postgres: cumin cumin 127.0.0.1(59878) idle       
cumin    14617 14445  0 07:34 ?        00:00:00 sleep 30
cumin    14618 14583  0 07:34 ?        00:00:00 sleep 30


Expected results:
only one instance of cumin service should be allowed to run

Additional info:

Comment 3 Trevor McKay 2011-02-01 13:35:25 UTC

*** This bug has been marked as a duplicate of bug 673273 ***

Comment 4 Jan Sarenik 2011-02-02 14:20:44 UTC
Reopening this bug back. It is not the same.
This makes sense to be fixed in 1.3.2, the other (673273) does not.

Comment 5 Trevor McKay 2011-02-11 17:30:13 UTC
Modified /etc/init.d/cumin (actually cumin/etc/sysvinit-cumin in the source tree) to check for running service and report "OK" if it is already running.

Fixed in trunk, revision 4518.

Comment 6 Trevor McKay 2011-02-14 15:31:51 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
    The /etc/init.d/cumin script does not check to see if the cumin service is already running before starting another instance of the service when the /sbin/service cumin start command is issued.

Consequence
    It is possible to unintentionally run multiple instances of cumin with new instances failing if they try to bind to the same port or succeeding if they use different ports.  This will consume extra resources and log files will be interleaved.

Fix
    The /etc/init.d/cumin script checks to see if the cumin service is already running before starting an instance of the service.

Result
    If the service is already running, the script reports success and exits.  If it is not, a new instance is started.

Comment 8 Jan Sarenik 2011-04-07 08:46:40 UTC
# service cumin start
Starting cumin:                                            [  OK  ]
# service cumin start
Starting cumin:                                            [  OK  ]

Is this all right? I wonder, should it fail on next try to start?

Comment 9 Trevor McKay 2011-04-07 14:08:44 UTC
Hi Jan,

  I tried postgresql, condor, and qpidd just to see what other services do.  I am not sure there is a standard for this.  I think "FAIL" is misleading, silence or OK seems to be the way to go.  What is your experience with other services?

  With the services running, here is what these others do on RHEL5:

[root@RHEL5Virt-tmckay ~]# /sbin/service postgresql start
Starting postgresql service:                               [  OK  ]
[root@RHEL5Virt-tmckay ~]# /sbin/service postgresql start
Starting postgresql service:                               [  OK  ]


[root@RHEL5Virt-tmckay ~]# /sbin/service condor start
Starting Condor daemons:                                   [  OK  ]
[root@RHEL5Virt-tmckay ~]# /sbin/service condor start

# Sorry, I have trace on....

[root@RHEL5Virt-tmckay ~]# /sbin/service qpidd start
Starting Qpid AMQP daemon: 2011-04-07 10:06:06 debug Forked daemon child process
2011-04-07 10:06:06 debug Forked daemon child process
                                                           [  OK  ]
[root@RHEL5Virt-tmckay ~]# /sbin/service qpidd start
Starting Qpid AMQP daemon: 
[root@RHEL5Virt-tmckay ~]#

Comment 10 Trevor McKay 2011-04-07 14:10:31 UTC
Condor returns to prompt, forgot to include it.
> 
> [root@RHEL5Virt-tmckay ~]# /sbin/service condor start
> Starting Condor daemons:                                   [  OK  ]
> [root@RHEL5Virt-tmckay ~]# /sbin/service condor start
>

Comment 11 Jan Sarenik 2011-04-08 08:00:05 UTC
Excuse me, I think you are right, just wanted to make sure.

Verified in cumin-0.1.4695-1.el5

Comment 12 errata-xmlrpc 2011-06-23 15:40:08 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2011-0889.html