How to resolve "Process leaked file descriptor" issue which caused job failure in Jenkins

9,553 views
Skip to first unread message

Victoria Wei Lei

unread,
Apr 14, 2015, 4:34:39 PM4/14/15
to jenkins...@googlegroups.com

I need to invoke two window processes in order to start our test after Jenkins build is down. They were normally killed after being brought up, and I receive "Process leaked file descriptors". I found someone suggest to do "set BUILD_ID=dontKillMe " before calling my command to start processes.
Good news is that the processes are able to stay. Bad news is "Process leaked file descriptors" still occur and mark Jenkins job failed, hence, I can't execute any test steps afterwards

Any input will be highly appreciated.

Victoria Wei Lei

unread,
Apr 16, 2015, 3:49:08 PM4/16/15
to jenkins...@googlegroups.com
if it is hard to get rid of "Process leaked file descriptors",  is there anyway I can make Jenkins ignore this failure step (or don't fail it),  so I can move on next step.  
I am looking at Conditional buildstep plugin,  but not able to figure out how this plugin work and whether it is the right plugin to achieve above goal? 

Please help.
Thanks
Victoria 

Mark Waite

unread,
Apr 16, 2015, 4:21:03 PM4/16/15
to jenkins...@googlegroups.com
I'm surprised if a process leaking a file descriptor would cause a build step to fail.  I've never seen it fail in any of the cases where it was reported on my jobs.

You may want to confirm that the build step did not fail, independent of whether or not there was a leaked file descriptor.  If you're building on Unix, be sure that the build step reports success (exit 0 from a shell script, etc.).

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1b0a16f2-a41d-4037-b793-2727882f64ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Victoria Wei Lei

unread,
Apr 16, 2015, 4:39:29 PM4/16/15
to jenkins...@googlegroups.com
Mark, 

the particular step is to call two processes by window batch command,  those processes are successfully running after I set BUILD_ID=dontKillMe.  Jenkins job was still marked as failure:
Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information
Build step 'Execute Windows batch command' marked build as failure

Thanks

Mark Waite

unread,
Apr 16, 2015, 6:08:28 PM4/16/15
to jenkins...@googlegroups.com
I think those two lines are independent of one another.  The line:


Build step 'Execute Windows batch command' marked build as failure

hints that the batch script returned a failure code to its calling environment.  I believe the default exit value for a batch script is the exit value of the last command executed in that script.  If you want to ignore that last return value, add 

EXIT 0

to the end of the first batch script so that it will always return success.

Mark Waite

Victoria Wei Lei

unread,
Apr 17, 2015, 1:20:05 PM4/17/15
to jenkins...@googlegroups.com
Super!!

It worked by adding Exit 0 in the end of batch.  The "process leaking file descriptor" still there, but Jenkins returns Success. 

Thank you so much, Mark!

Best regards
Victoria 
Message has been deleted

Mark Waite

unread,
Jun 23, 2017, 2:54:54 PM6/23/17
to Jenkins Users
In general, you don't need to fix the message that the process leaked file descriptors.  If the process leaks file descriptors, eventually it will exhaust the file descriptors, but that is not likely the cause of a problem for this specific job.

If you want processes to survive beyond the end of a job, then there are additional steps you need to take.  Refer to https://wiki.jenkins.io/display/JENKINS/Spawning+processes+from+build for techniques to keep a process running after the Jenkins job is complete.

Mark Waite

On Friday, June 23, 2017 at 12:57:19 AM UTC-6, parvatha reddy wrote:

mark, 

I did run Jenkins job in executing windows batch command. But Jenkins job itself kill all the child process.due to Runtime Environment will be down. 
can you please help us, how I can fix process leaked file descriptors issue.
execute shell the command:
 N: 
cd CCOP\REFRESH_SCRIPTS
rebuild_env.cmd %EnvType%
 

 for more information
Triggering a new build of YP » Runtime stop and restart on ST1 
Finished: SUCCESS 

Suhas

unread,
Aug 21, 2017, 2:39:24 AM8/21/17
to Jenkins Users
Hi Mark,

Just referred your comments and I have 0 to Exit as you shows below, and to my surprise jenkins error has disappeared, thanks a lot  

Suhas

unread,
Aug 21, 2017, 2:39:48 AM8/21/17
to Jenkins Users
Hi Mark, suffixing 0 to Exit has worked amazingly my issue has resolved. You deserve round of applaud. Many thanks Suhas India


On Friday, April 17, 2015 at 1:51:03 AM UTC+5:30, Mark Waite wrote:

Poonam Karia

unread,
Jul 18, 2018, 8:46:11 AM7/18/18
to Jenkins Users
Where to write this command script ?
When I got an error I ended up setting the environment variable as name=BUILD_ID and value= allow_to_run_as_daemon start_my_service. Can you please elaborate your solution if its working fine

Mark Waite

unread,
Jul 18, 2018, 8:49:43 AM7/18/18
to jenkins...@googlegroups.com
On Wed, Jul 18, 2018 at 6:46 AM Poonam Karia <poonam....@gmail.com> wrote:
Where to write this command script ?
When I got an error I ended up setting the environment variable as name=BUILD_ID and value= allow_to_run_as_daemon start_my_service. Can you please elaborate your solution if its working fine


Refer to https://wiki.jenkins.io/display/JENKINS/Spawning+processes+from+build .  I don't have any further details to offer than are already covered in that page.

Mark Waite
 
On Saturday, 24 June 2017 00:24:54 UTC+5:30, Mark Waite wrote:
In general, you don't need to fix the message that the process leaked file descriptors.  If the process leaks file descriptors, eventually it will exhaust the file descriptors, but that is not likely the cause of a problem for this specific job.

If you want processes to survive beyond the end of a job, then there are additional steps you need to take.  Refer to https://wiki.jenkins.io/display/JENKINS/Spawning+processes+from+build for techniques to keep a process running after the Jenkins job is complete.

Mark Waite

On Friday, June 23, 2017 at 12:57:19 AM UTC-6, parvatha reddy wrote:

mark, 

I did run Jenkins job in executing windows batch command. But Jenkins job itself kill all the child process.due to Runtime Environment will be down. 
can you please help us, how I can fix process leaked file descriptors issue.
execute shell the command:
 N: 
cd CCOP\REFRESH_SCRIPTS
rebuild_env.cmd %EnvType%
 

Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information
Triggering a new build of YP » Runtime stop and restart on ST1 
Finished: SUCCESS 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages