Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins kills JBoss server when job finishes

Tags:

jenkins

jboss

I use Ant to start/shutdown JBoss 5 server through Jenkins. Ant java spawn and fork are set to "true", so command is executed in the background.

Jenkins successfully starts up the server, waits two minutes (a "sleep" command in Jenkins), then after the sleep it for some strange reason shuts down the server. The sleep command is the last step in the build job. The shutdown says:

2013-01-29 17:03:39,332 INFO  [org.jboss.bootstrap.microcontainer.ServerImpl] Runtime     shutdown hook called, forceHalt: true

I googled it and tried the suggested -Xrs command, but it didn't help. What is happening here?

like image 662
user1340582 Avatar asked Jan 29 '13 14:01

user1340582


2 Answers

Jenkins have something called the process tree killer that will kill all processes created by the job (even those started with spawn and fork set to true).

There are some workarounds to this behavior.

  • disabling process tree killer

    -Dhudson.util.ProcessTreeKiller.disable=true

or

  • set the env. var BUILD_ID=dontKillMe in the JBOSS process.

    export BUILD_ID=dontKillMe

You can browse the ProcessTreeKill wiki article or jenkins JIRA to find various workarounds for this issue.

like image 167
ben75 Avatar answered Oct 08 '22 13:10

ben75


This source (comments) suggest other environment variables, apparently for older versions of Jenkins. For me it didn't work before I started using JENKINS(_SERVER)_COOKIE.

like image 38
Dormouse Avatar answered Oct 08 '22 14:10

Dormouse