Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

#666 closed defect (fixed)

AttributeError: 'NoneType' object has no attribute 'active'

Reported by: eblot Owned by: osimons
Priority: major Milestone: 0.6
Component: Build master Version: dev
Keywords: Cc:
Operating System: BSD

Description

When restarting a test session, the following traceback appears many times:

Traceback (most recent call last):
  File "/local/engine/trac/trac/web/main.py", line 511, in _dispatch_request
    dispatcher.dispatch(req)
  File "/local/engine/trac/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "/local/engine/bitten/bitten/master.py", line 107, in process_request
    return self._process_build_creation(req, slave_token)
  File "/local/engine/bitten/bitten/master.py", line 218, in _process_build_creation
    build = queue.get_build_for_slave(slavename, properties)
  File "/local/engine/bitten/bitten/queue.py", line 145, in get_build_for_slave
    if self.should_delete_build(build, repos):
  File "/local/engine/bitten/bitten/queue.py", line 322, in should_delete_build
    if not config.active:
AttributeError: 'NoneType' object has no attribute 'active'

Looking at the code, it seems that the culprit method is should_delete_build():

  1. trunk/bitten/model.py#L149 may return None, whereas
  2. trunk/bitten/queue.py#L307 dereference the config instance without testing for the None condition

Attachments (0)

Change History (4)

comment:1 follow-up: Changed 14 years ago by osimons

  • Milestone changed from 0.6.1 to 0.6
  • Owner set to osimons

So, just something like this should then be enough:

  • bitten/queue.py

    a b  
    319319            return True
    320320
    321321        # Ignore pending builds for deactived build configs
    322         if not config.active:
     322        if not (config and config.active):
    323323            self.log.info('Dropping build of configuration "%s" at '
    324324                     'revision [%s] on %s because the configuration is '
    325325                     'deactivated', config.name, build.rev, platform_name)

Makes sense. If the config is gone, then so should the build.

comment:2 in reply to: ↑ 1 Changed 14 years ago by eblot

Replying to osimons:

So, just something like this should then be enough

Yes, I wrote my own patch the other way around (if not config or not config.active:), no more exceptions since.

comment:3 Changed 14 years ago by osimons

I just spotted the subsequent logging of config.name, which may not work so well if config is None... A unittest would be quite useful to find and keep track of any pitfalls here.

comment:4 Changed 14 years ago by osimons

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

Fixed in [972:973]. Thanks Emmanuel.

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain osimons.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.