-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
mac Os Mojave 10.14.6
Flatform: OS: mac OS Mojave(10.14.6)
The build step execute shell contains fastlane build command to build Xcode app.
It uses fastlane and cocoapods using ram ruby.
fastlane Ruby executes script to build the Xcode app. After the build step completion, randomly, Jenkins leaves sub processes on system which consumes memory.
Process tree -1
M2:~ jenkins$ ps -ef | grep ruby
502 2186 1 0 Thu01PM ?? 0:07.62 ruby /Users/jenkins/.rvm/gems/ruby-2.6.3/bin/fastlane debugAdHoc
502 2779 2776 0 Thu01PM ?? 0:00.00 (ruby)
502 54343 1 0 Thu09AM ?? 0:02.69 ruby /Users/jenkins/.rvm/gems/ruby-2.6.3/bin/fastlane unitTestsBuild scheme:xxx-Debug
Process tree -2
M2:~ jenkins$ ps -ef | grep 54343
502 54343 1 0 Thu09AM ?? 0:02.69 ruby /Users/jenkins/.rvm/gems/ruby-2.6.3/bin/fastlane unitTestsBuild scheme:xxx-Debug
502 54398 54343 0 Thu09AM ?? 0:00.00 (sh)
502 9764 9297 0 1:26PM ttys001 0:00.00 grep 54343
Process tree -3
M2:~ jenkins$ ps -ef | grep 54398
502 54398 54343 0 Thu09AM ?? 0:00.00 (sh)
502 54399 54398 0 Thu09AM ?? 0:00.00 (xcodebuild)
502 54400 54398 0 Thu09AM ?? 0:00.00 (tee)
502 54401 54398 0 Thu09AM ?? 0:00.00 (ruby)
502 9760 9297 0 1:26PM ttys001 0:00.00 grep 54398
Process treee -4
M2:~ jenkins$ ps -ef | grep 54399
502 54399 54398 0 Thu09AM ?? 0:00.00 (xcodebuild)
502 54578 54399 0 Thu09AM ?? 0:00.00 (ibtool)
502 56436 54399 0 Thu09AM ?? 0:00.00 (bash)
502 9669 9297 0 1:26PM ttys001 0:00.00 grep 54399
Process tree -5
M2:~ jenkins$ ps aux | awk '{ print $8 " " $2 }' | grep -w Z
Z 2896
Z 54578
I tried to execute the following commands in next to the fastlane command step. But unable to kill the processes created by the execute shell.
At beginning of shell
export PROCESS_ID=`echo $$` # capture the shell process id
At the end of shell build step
bundle exec fastlane debugAdHocBuild
export ID=`pgrep -P $PROCESS_ID` # list the process ids of shell process id,
echo "ID=$ID"
kill -9 $ID || true
Where as ID could not retrieve any processes.
When we run ps -jA | grep PROCESS_ID on terminal, it is showing the ruby process and its subprocesses.
The subprocess “ruby” become orphan and tagged to init process.