<div dir="ltr"><div><div><div><div><div><div>I'm having a problem with workers randomly stopping. From the worker's logs, I'm seeing:<br><br>2018-01-26 01:22:33-0500 [-] sending app-level keepalive<br>2018-01-26 01:32:33-0500 [-] sending app-level keepalive<br>2018-01-26 01:42:33-0500 [-] sending app-level keepalive<br>2018-01-26 01:52:33-0500 [-] sending app-level keepalive<br>2018-01-26 02:00:00-0500 [-] Received SIGTERM, shutting down.<br>2018-01-26 02:00:00-0500 [HangCheckProtocol,client] Lost connection to <a href="http://10.159.135.58:9989">10.159.135.58:9989</a><br>2018-01-26 02:00:00-0500 [-] Stopping factory <buildbot_worker.pb.BotFactory instance at 0x7f50af441950><br>2018-01-26 02:00:00-0500 [-] Main loop terminated.<br>2018-01-26 02:00:00-0500 [-] Server Shut Down.<br><br></div>However, my master's still running, as well as other workers, so I don't know why a single worker would get receive a sigkill, and nothing else.<br><br></div>To work around this issue, I want to create a cronjob that periodically checks to see if the worker has stopped and restart it. Looking at the docs for buildbot-worker at <a href="http://docs.buildbot.net/latest/manual/cmdline.html">http://docs.buildbot.net/latest/manual/cmdline.html</a>, I see options to start, stop and restart, but there's no option to check status.<br><br></div>How do I check to see if a specific worker is running, so I know to restart it?<br><br></div>I tried just re-running `buildbot-worker start workerN` but that hangs if that worker is already running, showing the error message:<br><br>    Following twistd.log until startup finished..<br>    Another twistd server is running, PID 13758<br><br>    This could either be a previously started instance of your application or a<br>    different application entirely. To start a new one, either run it in some other<br>    directory, or use the --pidfile and --logfile parameters to avoid clashes.<br><br></div><div>Why does that not simply exit after showing the error message? I had to send ctrl-c to make it return.<br></div><div><br></div>And obviously I don't want to run `buildbot-worker restart workerN` because that will kill the current worker if it's already running, interrupting the current build.<br><br></div>I can check for the existence of <buildbot_dir>/workerN/twistd.pid, but that feels a little hacky and likely to break if Buildbot changes how it tracks worker pids.<br></div>