Edgewall Software
Modify

Opened 15 years ago

Closed 13 years ago

Last modified 13 years ago

#8658 closed defect (duplicate)

AttributeError: 'ResourceSystem' object has no attribute '_resource_managers_map'

Reported by: Christian Boos Owned by: Christian Boos
Priority: low Milestone:
Component: general Version: 0.11-stable
Severity: major Keywords: componentmanager
Cc: felix.schwarz@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

How to Reproduce

While issuing a bunch of concurrent requests, I got the following traceback:

Traceback (most recent call last):
  File "C:\Workspace\src\trac\repos\0.11-stable\trac\web\main.py", line 445, in _dispatch_request
    dispatcher.dispatch(req)
  File "C:\Workspace\src\trac\repos\0.11-stable\trac\web\main.py", line 206, in dispatch
    resp = chosen_handler.process_request(req)
  File "C:\Workspace\src\trac\repos\0.11-stable\trac\wiki\web_ui.py", line 166, in process_request
    return self._render_view(req, versioned_page)
  File "C:\Workspace\src\trac\repos\0.11-stable\trac\wiki\web_ui.py", line 489, in _render_view
    req.href, format=conversion[0])
  File "C:\Workspace\src\trac\repos\0.11-stable\trac\resource.py", line 291, in get_resource_url
    manager = ResourceSystem(env).get_resource_manager(resource.realm)
  File "C:\Workspace\src\trac\repos\0.11-stable\trac\resource.py", line 238, in get_resource_manager
    if not self._resource_managers_map:
AttributeError: 'ResourceSystem' object has no attribute '_resource_managers_map'

I already had similar failures in other testing sessions, and this amounts to a race condition in the ComponentManager, in source:trunk/trac/core.py, which can lead to methods of the component being called before the __init__ method itself has been called.

The fix is not trivial, I somehow stopped working on it, but I think it's worth recording the problem anyway and eventually fix it one day.

Well, actually there is a trivial fix, which would be to set variables like _resource_managers_map at the class level, which would avoid the internal error, but this ticket is more about solving the problem of __init__ not being guaranteed to be called before other methods can be called.

Typical "low prio" but "high severity" kind of ticket, as this leads to an internal error but fortunately happens only once in a blue moon…

Attachments (1)

t8658-Component-init.diff (1.1 KB ) - added by Christian Boos 14 years ago.
core: prevent possible use of uninitialized Component. Patch on top of r9839

Download all attachments as: .zip

Change History (11)

comment:1 by Christian Boos, 14 years ago

Milestone: 2.0unscheduled

Milestone 2.0 deleted

by Christian Boos, 14 years ago

Attachment: t8658-Component-init.diff added

core: prevent possible use of uninitialized Component. Patch on top of r9839

comment:2 by Christian Boos, 14 years ago

Milestone: triaging0.12.1
Status: newassigned

As discussed in #9418, we can trade the above problem for an (increased) chance to get multiple instances created, which is certainly less damaging most of the time. At worst, these extra instances will result in caches created for a one time use.

Last edited 14 years ago by Christian Boos (previous) (diff)

comment:3 by Christian Boos, 14 years ago

Milestone: 0.12.10.13

Still, I wouldn't touch that in 0.12-stable, now.

comment:4 by Felix Schwarz, 14 years ago

Cc: felix.schwarz@… added

comment:5 by Christian Boos, 14 years ago

Milestone: 0.130.12.2

t8658-Component-init.diff applied in r10242.

Thanks to Felix Schwarz for reviving the issue and for independent rediscovery of the fix ;-)

comment:6 by Christian Boos, 14 years ago

Resolution: fixed
Status: assignedclosed

in reply to:  5 comment:7 by Felix Schwarz, 14 years ago

Replying to cboos:

t8658-Component-init.diff applied in r10242.

Thanks for applying this so quickly. However I had quite a lot of fallout for Agilo due to that. Granted, Agilo is one of the most complex 'plugins' for Trac and I identified quite a lot of bad design decisions during that plugin but I guess the change might break other plugins as well.

Therefore I'd like to propose that the change is only done in trunk but not for 0.12 stable to minimize potential issues in the stable series.

comment:8 by Christian Boos, 14 years ago

Resolution: fixed
Status: closedreopened

On trunk I'd rather go the way proposed in #9418 anyway. Did you have a chance to review and test the proposed change?

As for r10242, I would be OK to revert it on 0.12-stable.

comment:9 by Christian Boos, 13 years ago

Resolution: duplicate
Status: reopenedclosed

r10242 reverted in r10292, also on trunk to make way for jomae's patch on #9418.

comment:10 by Christian Boos, 13 years ago

Milestone: 0.12.2

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.