Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#3182 closed undecided (fixed)

MailNotifier throws exceptions.AttributeError: 'NoneType' object has no attribute 'subscribe'

Reported by: daniel@… Owned by:
Priority: major Milestone: undecided
Version: master Keywords: mail, osx


I get the following exception when using MailNotifier?:

	  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/", line 1155, in gotResult
	    _inlineCallbacks(r, g, deferred)
	  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/", line 1099, in _inlineCallbacks
	    result = g.send(result)
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/util/", line 43, in reconfigServiceWithBuildbotConfig
	    yield svc.reconfigServiceWithBuildbotConfig(new_config)
	  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/", line 1237, in unwindGenerator
	    return _inlineCallbacks(None, gen, Deferred())
	--- <exception caught here> ---
	  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/", line 1099, in _inlineCallbacks
	    result = g.send(result)
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/status/", line 92, in reconfigServiceWithBuildbotConfig
	    yield sr.setServiceParent(self)
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/status/", line 469, in setServiceParent
	exceptions.AttributeError: 'NoneType' object has no attribute 'subscribe'

Repro steps:

  1. buildbot create-master temp-master
  2. mv temp-master/temp-master.cfg.sample temp-master/master.cfg
  3. Change the cfg file to include the following lines:
from buildbot.plugins import status
m = status.MailNotifier(fromaddr="buildbot@localhost", extraRecipients=[""], sendToInterestedUsers=False)
c['status'] = []
  1. buildbot start temp-master

Change History (12)

comment:1 Changed 6 years ago by ewong

I think I might know why it's tracebacking.

in status/

def setServiceParent(self, parent):

self.master_status = self.parent self.master_status.subscribe(self) self.master = self.master_status.master return base.StatusReceiverMultiService?.setServiceParent(self, parent)

I think the first line in setServiceParent() should be

self.master_status = parent

Since self.parent doesn't exist (from my cursory glance) in MailNotifier?()

If this is correct, I'll get a GP up.

(I just tested my hypothesis, and it seems to reconfig properly... )

comment:2 Changed 6 years ago by ewong

Got GH:1525 up for review.

comment:3 Changed 6 years ago by daniel@…


I changed the code locally and I also doesn't get the exception anymore so I will do some more testing to make sure the MailNotifier? works.


comment:4 Changed 6 years ago by ewong

the fix was easy to figure out. Now I need to figure out the test that needs to come with it.

comment:5 Changed 6 years ago by daniel@…

This may or may not be related but when I tried this for real (I submitted a failing git commit) I now get this:

2015-02-05 10:18:35+0100 [-] Exception caught notifying <buildbot.status.mail.MailNotifier object at 0x10f2d33d0> of buildFinished event
2015-02-05 10:18:35+0100 [-] Unhandled Error
	Traceback (most recent call last):
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/status/", line 267, in buildFinished
	  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/", line 382, in callback
	  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/", line 490, in _startRunCallbacks
	  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/", line 577, in _runCallbacks
	    current.result = callback(current.result, *args, **kw)
	--- <exception caught here> ---
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/status/", line 582, in _buildFinished
	    w.buildFinished(name, s, results)
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/status/", line 554, in buildFinished
	    return self.buildMessage(name, [build], results)
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/status/", line 752, in buildMessage
	    build=build, results=build.results)
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/status/", line 733, in buildMessageDict
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/status/", line 212, in defaultMessage
	    text += "Blamelist: %s\n" % ",".join(build.getResponsibleUsers())
	exceptions.TypeError: sequence item 0: expected string, NoneType 

I have setup the mailing like this (realname and pass removed)

mn = status.MailNotifier(fromaddr=“",
                         relayhost="", smtpPort=587,

comment:6 Changed 6 years ago by ewong

Do you happen to have any other config errors?

I don't see extraRecipients defined in your config and looking at the code, there should be a config.error raised, unless I missed something.

comment:7 Changed 6 years ago by daniel@…

I have no config errors (I also added extraRecipients to make sure that isn't the problem) but still the same issue. I also notice by looking at the log I get this error a while before the above Blamelist error) but it seems to process just fine even if this happens (but it may perhaps cause the other issue)

2015-02-05 11:15:26+0100 [-] added change with revision 3bb9302e5fe2d4f48e7ae82d012d944d23562136 to database
2015-02-05 11:15:27+0100 [-] added buildset 18 to database
2015-02-05 11:15:27+0100 [-] while invoking <bound method Status.br_consumer_cb of <buildbot.status.master.Status instance at 0x108935ea8>>
	Traceback (most recent call last):
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/data/", line 69, in produceEvent, msg)
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/mq/", line 43, in produce
	    qref.invoke(routingKey, data)
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/mq/", line 41, in invoke
	    x = self.callback(routing_key, data)
	  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/", line 1237, in unwindGenerator
	    return _inlineCallbacks(None, gen, Deferred())
	--- <exception caught here> ---
	  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/", line 1099, in _inlineCallbacks
	    result = g.send(result)
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/status/", line 429, in br_consumer_cb
	    msg['brid'], self)
	exceptions.KeyError: 'brid'

comment:8 Changed 6 years ago by dustin

It looks like ewong's patch fixed the first traceback.

The last should be similarly easy to fix -- see what kind of data API dictionary br_consumer_cb is getting, and why it doesn't have a brid key.

In general, MailNotifier?'s still built around the old Status hierarchy, and hasn't been upgraded to use the data API. It's been hacked around the edges to keep it sort of functional, but you're seeing some of the problems with that now.

comment:9 Changed 6 years ago by ewong

I'm looking at the datadict, and I'm thinking brid should actually be changed to buildrequestid.

Being 'lazy' that I am, I'm putting the GH:1528 here.

Last edited 6 years ago by ewong (previous) (diff)

comment:10 Changed 6 years ago by dustin

  • Resolution set to fixed
  • Status changed from new to closed

Nice work - thanks!

comment:11 Changed 5 years ago by daniel@…

Thanks for fixing this!

I'm stilling having the "build.getResponsibleUsers()" issue so I wonder if I should create a separate ticket for that?


comment:12 Changed 5 years ago by sa2ajj

Daniel, please do file a separate ticket.

Note: See TracTickets for help on using tickets.