#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)
Change History (11)
comment:1 by , 15 years ago
Milestone: | 2.0 → unscheduled |
---|
by , 15 years ago
Attachment: | t8658-Component-init.diff added |
---|
core: prevent possible use of uninitialized Component. Patch on top of r9839
comment:2 by , 15 years ago
Milestone: | triaging → 0.12.1 |
---|---|
Status: | new → assigned |
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.
comment:3 by , 14 years ago
Milestone: | 0.12.1 → 0.13 |
---|
Still, I wouldn't touch that in 0.12-stable, now.
comment:4 by , 14 years ago
Cc: | added |
---|
follow-up: 7 comment:5 by , 14 years ago
Milestone: | 0.13 → 0.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 , 14 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:7 by , 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 , 14 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:9 by , 14 years ago
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
comment:10 by , 14 years ago
Milestone: | 0.12.2 |
---|
Milestone 2.0 deleted