Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1130362

Summary: app-stop can not stop all process in pyhton app with 'app.py' after start it twice
Product: OpenShift Container Platform Reporter: Ma xiaoqiang <xiama>
Component: ImageStreamsAssignee: Brenton Leanhardt <bleanhar>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 2.1.0CC: adellape, bleanhar, jokerman, libra-onpremise-devel, lmeyer, mmccomas, xtian
Target Milestone: ---Keywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openshift-origin-cartridge-python-1.23.4.7-1 Doc Type: Bug Fix
Doc Text:
A race condition in the Python cartridge's start method caused the pid file to be written incorrectly in certain situations. This could lead to problems when stopping applications. This bug fix updates the Python cartridge to address the race condition, and the issue no longer occurs as a result. After applying this fix, a cartridge migration is required.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-11 20:06:43 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:
Bug Depends On: 1114477    
Bug Blocks:    

Description Ma xiaoqiang 2014-08-15 03:16:12 UTC
Description of problem:
When file 'app.py' exists, the stop action can't kill the 'python app.py' process after start it twice.

Version-Release number of selected component (if applicable):
puddle [2.1.z/2014-08-13.1]

How reproducible:
100%

Steps to Reproduce:
1. Create a pyhon app
#rhc app create ajeamkpi python-3.3 mongodb-2.4 --from-code https://github.com/openshift-quickstart/Bottle-Python3-quickstart 
2.Start the app twice
#rhc app start ajeamkpi
3. Stop the app
#rhc app stop ajeamkpi
4.access the app

Actual results:
The app is still accessible 

Expected results:
Can not access the app

Additional info:
vim python/usr/versions/3.3/bin/control 
function start_app()
...
    rm -f $LOGPIPE && mkfifo $LOGPIPE
    /usr/bin/logshifter -tag python < $LOGPIPE &
    nohup python -u app.py &> $LOGPIPE &
    if [ "$?" == "0" ]; then
      echo $! > $OPENSHIFT_PYTHON_DIR/run/appserver.pid
    else
These code only change the pid in $OPENSHIFT_PYTHON_DIR/run/appserver.pid when start the app for the second time

Comment 1 Luke Meyer 2014-08-15 13:20:21 UTC
This does not appear to happen upstream. I suspect it was addressed by the PR in bug 1114477.

Comment 2 Brenton Leanhardt 2014-08-26 00:46:30 UTC
Upstream commit:

commit 4a567c49eb6a1fae6b11eee9b82fd477fddd1ca7
Author: jhadvig <jhadvig>
Date:   Mon Jun 30 16:12:03 2014 +0200

    Bug 1114477: Incorrect pid written into appserver.pid upon python cartridge start action

Comment 5 Ma xiaoqiang 2014-08-26 05:19:58 UTC
Check on puddle [2.1.z/2014-08-25.2]

1. Create a pyhon app
#rhc app create ajeamkpi python-3.3 mongodb-2.4 --from-code https://github.com/openshift-quickstart/Bottle-Python3-quickstart 
2.Start the app twice
#rhc app start ajeamkpi
3. Stop the app
#rhc app stop ajeamkpi
4. Access the app
The app is not accessible
5. Start the app, access it
The app is accessible

Comment 7 errata-xmlrpc 2014-09-11 20:06:43 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-2014-1183.html