Opened 5 years ago

Closed 5 years ago

#3329 closed defect (fixed)

slave protocol Listener class tries to set `self.master`

Reported by: dustin Owned by: dustin
Priority: critical Milestone: 0.9.0b2
Version: master Keywords:
Cc: Lurimax, tardyp

Description

Unhandled Error
Traceback (most recent call last):
  File "/home/bbuser/venv/lib/python2.7/site-packages/twisted/application/app.py", line 617, in run
    runApp(config)
  File "/home/bbuser/venv/lib/python2.7/site-packages/twisted/scripts/twistd.py", line 25, in runApp
    _SomeApplicationRunner(config).run()
  File "/home/bbuser/venv/lib/python2.7/site-packages/twisted/application/app.py", line 348, in run
    self.application = self.createOrGetApplication()
  File "/home/bbuser/venv/lib/python2.7/site-packages/twisted/application/app.py", line 413, in createOrGetApplication
    application = getApplication(self.config, passphrase)
--- <exception caught here> ---
  File "/home/bbuser/venv/lib/python2.7/site-packages/twisted/application/app.py", line 424, in getApplication
    application = service.loadApplication(filename, style, passphrase)
  File "/home/bbuser/venv/lib/python2.7/site-packages/twisted/application/service.py", line 411, in loadApplication
    passphrase)
  File "/home/bbuser/venv/lib/python2.7/site-packages/twisted/persisted/sob.py", line 207, in loadValueFromFile
    eval(codeObj, d, d)
  File "buildbot.tac", line 28, in <module>
    m = BuildMaster(basedir, configfile, umask)
  File "/usr/home/bbuser/buildbot/master/buildbot/master.py", line 95, in __init__
    self.create_child_services()
  File "/usr/home/bbuser/buildbot/master/buildbot/master.py", line 141, in create_child_services
    self.buildslaves = bslavemanager.BuildslaveManager(self)
  File "/usr/home/bbuser/buildbot/master/buildbot/buildslave/manager.py", line 69, in __init__
    self.pb = bbpb.Listener(master)
  File "/usr/home/bbuser/buildbot/master/buildbot/buildslave/protocols/pb.py", line 30, in __init__
    base.Listener.__init__(self, master)
  File "/usr/home/bbuser/buildbot/master/buildbot/buildslave/protocols/base.py", line 24, in __init__
    self.master = master
exceptions.AttributeError: can't set attribute


Failed to load application: can't set attribute

This is due to the switch to new-style classes, where properties can't be set. Two things to worry about in fixing this: (1) all calls to the Listener constructor need to be modified to not pass a master instance and (2) there's a chance that something refers to self.master before the service is added to the service hierarchy, which will lead to a runtime exception.

I'm a bit curious how tests didn't catch this issue :(

Change History (7)

comment:1 Changed 5 years ago by sa2ajj

  • Summary changed from slave protocol Listenre class tries to set `self.master` to slave protocol Listener class tries to set `self.master`

comment:2 Changed 5 years ago by dustin

  • Owner set to dustin
  • Status changed from new to assigned

This is popping up with the newest Twisted, where Service has become a new-style class.

comment:3 Changed 5 years ago by dustin

  • Cc tardyp added

In fact, this is much, much deeper. There are lots of instances of self.master = master, and many of them are necessary as self.master is used before the object is added to the inheritance hierarchy.

I don't have time to chase down all of those loose ends. For 0.9.0b2, perhaps we should just required Twisted<=15.0.0? Pierre, what do you think?

comment:4 Changed 5 years ago by jvlomax

I'm not Pierre, but I think this might be a good idea. Since trial is now also ported to python3, I think it would make sense to have a buildbot that supports python3, only support a version of twisted that can run its tests in python3

comment:5 Changed 5 years ago by dustin

To be explicit, the options are:

  • fix all self.master = master, each of which requires addressing (1) and (2), including in tests (a lot of work)
  • remove the master property from AsyncService and just set self.master explicitly in every class
  • Modify setup.py to require Twisted <= 15.0.0 until one of the above is done

Noting that the last option would preclude Python-3, since Twisted <= 15.0.0 is not Python-3 compatible.

comment:7 Changed 5 years ago by dustin

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.