Unable to restart the buildbot master

1.3k Views Asked by At

I am running Buildbot version 0.8.8 on Windows7.

I have the configuration (master.cfg) file which creates all the builders using a small trick. I read a XML file from the subversion which lists all the steps for the builders. Something like:

<Builder name="BuilderA" description="Builds the A project">
    <Command name="Clean">-v -t realclean -p my\\projA</Command>
    <Command name="Release">-v -t release -p my\\projA</Command>
</Builder>

<Builder name="BuilderB" description="Builds the B project">
    <Command name="Clean">-v -t realclean -p my\\projB</Command>
    <Command name="Release">-v -t release -p my\\projB</Command>
</Builder>

The idea is that any developer can change the XML file in the subversion and then buildmaster could be restarted in order to have the new buildbot configuration.

I start the buildbot using the command: buildbot start C:\master_dir

The issue I am facing is that when I am trying to restart the buildbot it complains that buildmaster not running. Digging deep into the sources I found that it fails in buildbot\scripts\stop.py:34 when trying to open the twisted.pid file.

pidfile = os.path.join(basedir, 'twistd.pid')
try:
    with open(pidfile, "rt") as f:
        pid = int(f.read().strip())
except:
    if not config['quiet']:
        print "buildmaster not running"
    return 0

I have no idea what is this twisted.pid file and why buildbot is looking for this? Any help or ideas will be appreciated. Thanks.

2

There are 2 best solutions below

1
On

The information you have so far provided falls short of showing that anything is actually wrong.

twistd.pid is the buildmaster's process-id file. Its existence indicates that the buildmaster is running. Its absence indicates that the buildmaster is not running.

Restarting the buildmaster means stopping it then starting it. Stopping it makes buildbot check for the buildmaster's pid file. If there is no pid file, then it informs you that the buildmaster is not running, and proceeds to start it.

So:-

  • This message is quite in order unless you know that the buildmaster is running when you restart it and observe this message. Do you know that?

  • The message is harmless information, unless the buildmaster also fails to start. Do you know that it fails to start?

If you know that the buildmaster was running when buildbot said it was not, and that it failed to start when you tried to restart it, then the first thing one would like to know is: Exactly what command did you run to restart the buildmaster and in what directory did you run it?

0
On

I am experiencing the same issue. It seems on windows the file twistd.pid is not created. I am not sure where the bug comes from, but I reported the bug to buildbot team: http://trac.buildbot.net/ticket/3512

As workaround, I now added in my master.cfg:

import os
if not os.path.exists("twistd.pid"):
    with open("twistd.pid", "w") as pidfile:
        pidfile.write("{}".format(os.getpid()))

EDIT: Actually, it seems the PID file is not deleted after stopping... So I try with this more:

else:
    realpid = os.getpid()
    filepid = 0
    with open("twistd.pid", "r") as pidfile:
        filepid = int(pidfile.read())
    if filepid == 0 or filepid != realpid:
        with open("twistd.pid", "w") as pidfile:
            pidfile.write("{}".format(realpid))

It seems to work, but you would get an error if you try to stop buildbot when it is really not running, as the PID file would yield a wrong PID and it would try to kill it.