Bug 872123

Summary: Stopped app's ~/app-root/runtime/.state file changed from "stopped" to "started" after git push
Product: OKD Reporter: Meng Bo <bmeng>
Component: ContainersAssignee: Jhon Honce <jhonce>
Status: CLOSED UPSTREAM QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: dmace, dmcphers, jhonce, mmcgrath, qgong
Target Milestone: ---Keywords: FutureFeature, Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-16 16:16:31 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 Meng Bo 2012-11-01 10:29:06 UTC
Description of problem:
Create app and stop the app via rhc client. Do some changes in the git repo and push it to the server. Check the status of the app from client side, it will say:
"Geargroup <cart> is started". 

Login to the app via ssh can found the service for the framework is not running.
Access the app URL via browser, got 503 error.

So the app status is actually STOPPED but the .state file changed after git push.


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

How reproducible:
always

Steps to Reproduce:
1.Create app
2.Stop the app
3.Do some change iin the git repo and git push
4.Check the app status via rhc client

  
Actual results:
RESULT:
Geargroup jbossas-7 is started

Expected results:
It should show the Geargroup is stopped.

Additional info:

[bmeng@localhost openshift_testdir]$ rhc app stop jbas1

RESULT:
jbas1 stopped
[bmeng@localhost jbas1]$ touch 123;git add .;git commit -am test;git push
[master d589bdd] test
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 1234
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 239 bytes, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: restart_on_add=false
remote: Application is already stopped
remote: Done
remote: restart_on_add=false
remote: ~/git/jbas1.git ~/git/jbas1.git
remote: ~/git/jbas1.git
remote: Running .openshift/action_hooks/pre_build
remote: Running .openshift/action_hooks/build
remote: Running .openshift/action_hooks/deploy
remote: hot_deploy_added=false
remote: Application is explicitly stopped!  Use 'rhc app start -a jbossas-7' to start back up.
remote: Done
remote: Running .openshift/action_hooks/post_deploy
To ssh://ca3edacc01bc49e790e927d2d0d075c5.rhcloud.com/~/git/jbas1.git/
   4ba63c7..d589bdd  master -> master

[bmeng@localhost jbas1] rhc app show --state jbas1

RESULT:
Geargroup jbossas-7 is started

Comment 1 Dan Mace 2012-11-01 16:09:24 UTC
Reducing priority for this release. The bug still exists in production (but takes a slightly different form: the state is incorrect post-build, but is stuck in "deploying" rather than "started").

The problem in the current master branch is in the stop_app function in the abstract cart util:

origin-server/cartridges/openshift-origin-cartridge-abstract/abstract/info/lib/util

The function does an unconditional "set_app_state started" which doesn't honor any stop_lock which might be present in the gear's cart directories. Unfortunately, this hook is invoked from the abstract start_app.sh script which doesn't provide enough context to easily check the locks, meaning it'll take too much time and testing to sort out this late in the release.

So, given the fact that it's not a regression, and that the fix is non-trivial, we're going to lower the priority for now and tackle it in the next release.

Comment 2 Rony Gong 🔥 2012-11-08 08:07:39 UTC
Also faild for set app idle first, then gitpush to this app.
After gitpush, app is idle actuall, but app status show app is started.

Comment 3 Dan Mace 2012-11-29 19:51:01 UTC
Resolved by https://github.com/openshift/origin-server/pull/992

Comment 4 Meng Bo 2012-12-03 02:56:45 UTC
Checked on devenv_2547, issue has been fixed.

Make app stopped or idle before git push, do some change and push it, check the app status again. The status is still keeping idle or stopped. Check the .state file under $OPENSHIFT_REPO_DIR/runtime, it is still keeping idle or stopped.

Mark bug as VERIFIED.

Comment 5 Jhon Honce 2013-01-17 00:12:15 UTC
Fix broke 'rhc app start...' 

Fix reverted in https://github.com/openshift/origin-server/pull/1157

No easy solution to problem.

Comment 6 Jhon Honce 2013-01-31 16:25:30 UTC
The issue is the code from git push and rhc start use the same function, one requires the state to change while the other does not. The cartridge refactor will not create the same problem.

Comment 7 manoj 2013-02-11 16:21:28 UTC
Jhonce,

Can this be fixed before the cartridge refactor?

Comment 8 Jhon Honce 2013-02-12 05:35:05 UTC
The issue is the code from git push and rhc start use the same function, one requires the state to change while the other does not. The cartridge refactor will not create the same problem.

Comment 9 Mike McGrath 2013-04-16 16:12:16 UTC
Note: This is being worked on in v2 and will likely not be valid after that.

Comment 10 Jhon Honce 2013-04-16 16:16:31 UTC
Fixed in new cartridge format