Bug 835876

Summary: [Origin] app_ctl_stop.sh script always try to kill Passenger processes owned by other users when git push for ruby app.
Product: OKD Reporter: Johnny Liu <jialiu>
Component: ContainersAssignee: Ram Ranganathan <ramr>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: bleanhar, mfisher, ramr
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: > rhc-cartridge-ruby-1.8-0.95.1 and > rhc-cartridge-ruby-1.9-0.2.2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-13 23:43:51 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 Johnny Liu 2012-06-27 12:07:30 UTC
Description of problem:
Setup multi-node open-source PaaS using RHEL vms, do git push, will seen:
<--snip-->
remote: pkill: 13888 - Operation not permitted
remote: pkill: 13891 - Operation not permitted
remote: pkill: 13896 - Operation not permitted
remote: pkill: 16632 - Operation not permitted
remote: pkill: 16641 - Operation not permitted
remote: pkill: 16650 - Operation not permitted
<--snip-->


In cartridges/ruby-1.8/info/bin/app_ctl_stop.sh:
for i in {1..20}
do
    if `ps --pid $httpd_pid > /dev/null 2>&1` || `pgrep Passenger.* > /dev/null 2>&1`
    then
        if [ $i -gt 4 ]
        then
            if `ps --pid $httpd_pid > /dev/null 2>&1`
            then
                if [ $i -gt 16 ]
                then
                    /bin/kill -9 $httpd_pid
                fi
            elif `pgrep Passenger.* > /dev/null 2>&1`
            then
                pkill -9 Passenger.*
                break
            fi
        fi
        echo "Waiting for stop to finish"
        sleep .5
    else
        break
    fi
done


Due to app linux user can list all the processes on multi-node open-source PaaS, "pgrep Passenger.*" will always retrun true. That is the root cause.

Version-Release number of selected component (if applicable):
cartridge-ruby-1.8-0.94.1-1.git.81.5faf60b.el6.noarch

How reproducible:
always

Steps to Reproduce:
1.Setup multi node env using rhel6.2 vms.
2.Create ruby app
3.Do some change, and git push.
  
Actual results:
$ git commit -a -mx; git push
[master 93976b6] x
 1 file changed, 1 insertion(+), 1 deletion(-)
Warning: Permanently added 'racktest-newjialiu.example.com,10.66.9.106' (RSA) to the list of known hosts.
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 271 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Stopping application...
remote: httpd: Could not reliably determine the server's fully qualified domain name, using node0.example.com for ServerName
remote: Waiting for stop to finish
remote: Waiting for stop to finish
remote: Waiting for stop to finish
remote: Waiting for stop to finish
remote: pkill: 13888 - Operation not permitted
remote: pkill: 13891 - Operation not permitted
remote: pkill: 13896 - Operation not permitted
remote: pkill: 16632 - Operation not permitted
remote: pkill: 16641 - Operation not permitted
remote: pkill: 16650 - Operation not permitted
remote: Done
remote: ~/git/racktest.git ~/git/racktest.git
remote: ~/git/racktest.git
remote: Running .openshift/action_hooks/pre_build
remote: Running .openshift/action_hooks/build
remote: Running .openshift/action_hooks/deploy
remote: Starting application...
remote: httpd: Could not reliably determine the server's fully qualified domain name, using node0.example.com for ServerName
remote: Done
remote: Running .openshift/action_hooks/post_deploy
To ssh://95b7841a9d114cb3a36c3a282a982422.com/~/git/racktest.git/
   74c4c4f..93976b6  master -> master


Expected results:
Stop script should try to kill Passenger processes owned by other users on multi-node open-source PaaS.

Additional info:

Comment 1 Ram Ranganathan 2012-06-27 22:14:32 UTC
Fixed with git commit : 28510c8a8e4cb4c2ddb9bcc17927334402a36da6

Changes applied to both ruby-1.8 and ruby-1.9 cartridges

Comment 2 Johnny Liu 2012-06-28 08:36:54 UTC
For now, this patch is not merged to features/mcollective, once merge is done, I will retest this bug.

Comment 3 Johnny Liu 2012-07-02 09:41:11 UTC
Veirfied this bug with cartridge-ruby-1.8-0.95.1-1.git.43.24340c9.fc16.noarch on origin env and PASS.

Also verified this bug on devenv_1869 (need set selinux to permissive), also passed.