Opened 14 years ago

Last modified 13 years ago

#7099 closed defect

ReferenceError: weakly-referenced object no longer exists — at Version 5

Reported by: support@… Owned by: pdoup
Priority: normal Component: TimelineComponentFilterPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description (last modified by Ryan J Ollos)

Trac detected an internal error:

ReferenceError: weakly-referenced object no longer exists

This is probably a local installation issue.
Found a bug in Trac?

If you think this should work and you can reproduce the problem, you should consider reporting this to the Trac team.

Before you do that, though, please first try searching for similar issues, as it is quite likely that this problem has been reported before. For questions about installation and configuration of Trac, please try the mailing list instead of filing a ticket.

==== How to Reproduce ====
While doing a GET operation on `/timeline`, Trac issued an internal error. ''(please provide additional details here)'' User Agent was: `Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100315 Firefox/3.5.9 ZarafaCheck/1.1.1.20080624.110` ==== System Information ==== || '''Trac''' || `0.11.6` || || '''Python''' || `2.4.3 (#1, Sep 3 2009, 15:37:12) ` [[br]] `[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]` || || '''setuptools''' || `0.6c7` || || '''SQLite''' || `3.3.6` || || '''pysqlite''' || `1.1.7` || || '''Genshi''' || `0.5.1` || || '''mod_python''' || `3.2.8` || || '''Subversion''' || `1.4.2 (r22196)` || || '''jQuery:''' || `1.2.6` || ==== Python Traceback ==== {{{ Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/Trac-0.11.6-py2.4.egg/trac/web/main.py", line 450, in _dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.4/site-packages/Trac-0.11.6-py2.4.egg/trac/web/main.py", line 227, in dispatch data, content_type) File "/usr/lib/python2.4/site-packages/Trac-0.11.6-py2.4.egg/trac/web/chrome.py", line 745, in render_template stream |= self._filter_stream(req, method, filename, stream, data) File "/usr/lib/python2.4/site-packages/genshi/core.py", line 128, in __or__ return Stream(_ensure(function(self)), serializer=self.serializer) File "/usr/lib/python2.4/site-packages/Trac-0.11.6-py2.4.egg/trac/web/chrome.py", line 848, in inner data) File "/home/trac/Textkernel/plugins/TimelineComponentFilter.py", line 46, in filter_stream return stream | filter.before(tag.br()) | filter.before(tag.label("Filter Components (none for all): ")) | filter.before(tag.br()) | filter.before(self._components_field_input(req)) File "/home/trac/Textkernel/plugins/TimelineComponentFilter.py", line 51, in _components_field_input cursor.execute("SELECT name FROM component ORDER BY name") File "/usr/lib/python2.4/site-packages/Trac-0.11.6-py2.4.egg/trac/db/util.py", line 65, in execute return self.cursor.execute(sql) File "/usr/lib/python2.4/site-packages/sqlite/main.py", line 233, in execute if self.con.autocommit: ReferenceError: weakly-referenced object no longer exists }}} a new ticket at the Trac project site, where you can describe the problem and explain how to reproduce it.
Python Traceback
Most recent call last:

    * File "/usr/lib/python2.4/site-packages/Trac-0.11.6-py2.4.egg/trac/web/main.py", line 450, in _dispatch_request
      Code fragment:
       445. try:
       446. if not env and env_error:
       447. raise HTTPInternalError(env_error)
       448. try:
       449. dispatcher = RequestDispatcher(env)
       450. dispatcher.dispatch(req)
       451. except RequestDone:
       452. pass
       453. resp = req._response or []
       454.  
       455. except HTTPException, e:
      Local variables:
      Name	Value
      after 	[u' except RequestDone:', u' pass', u' resp = ...
      before 	[u' try:', u' if not env and env_error:', u' raise ...
      dispatcher 	<trac.web.main.RequestDispatcher object at 0x9159e8c>
      e 	<exceptions.ReferenceError instance at 0x91cd50c>
      env 	<trac.env.Environment object at 0x90bd8ec>
      env_error 	None
      exc_info 	(<class exceptions.ReferenceError at 0xb7f94dac>, ...
      filename 	'/usr/lib/python2.4/site-packages/Trac-0.11.6-py2.4.egg/trac/web/main.py'
      frames 	[{'function': '_dispatch_request', 'lines_before': [u' try:', u' ...
      has_admin 	True
      line 	u' dispatcher.dispatch(req)'
      lineno 	449
      message 	u'ReferenceError: weakly-referenced object no longer exists'
      req 	<Request "GET u'/timeline'">
      resp 	[]
      tb 	<traceback object at 0xb7856694>
      tb_hide 	None
      traceback 	u'Traceback (most recent call last):\n File ...
    * File "/usr/lib/python2.4/site-packages/Trac-0.11.6-py2.4.egg/trac/web/main.py", line 227, in dispatch
      Code fragment:
       222. out = StringIO()
       223. pprint(data, out)
       224. req.send(out.getvalue(), 'text/plain')
       225. else:
       226. output = chrome.render_template(req, template,
       227. data, content_type)
       228. # Give the session a chance to persist changes
       229. req.session.save()
       230. req.send(output, content_type or 'text/html')
       231. else:
       232. self._post_process_request(req)
      Local variables:
      Name	Value
      chosen_handler 	<trac.timeline.web_ui.TimelineModule object at 0x915942c>
      chrome 	<trac.web.chrome.Chrome object at 0x91c102c>
      content_type 	None
      data 	{'dateinfo': <function dateinfo at 0x90bce9c>, 'context': <Context >, ...
      err 	(<class exceptions.ReferenceError at 0xb7f94dac>, ...
      handler 	<trac.timeline.web_ui.TimelineModule object at 0x915942c>
      req 	<Request "GET u'/timeline'">
      resp 	('timeline.html', {'dateinfo': <function dateinfo at 0x90bce9c>, ...
      self 	<trac.web.main.RequestDispatcher object at 0x9159e8c>
      template 	'timeline.html'
    * File "/usr/lib/python2.4/site-packages/Trac-0.11.6-py2.4.egg/trac/web/chrome.py", line 745, in render_template
      Code fragment:
       740.  
       741. stream = template.generate(**data)
       742.  
       743. # Filter through ITemplateStreamFilter plugins
       744. if self.stream_filters:
       745. stream |= self._filter_stream(req, method, filename, stream, data)
       746.  
       747. if fragment:
       748. return stream
       749.  
       750. if method == 'text':
      Local variables:
      Name	Value
      content_type 	'text/html'
      data 	{'abs_url_of': <function get_abs_url at 0xb780c1b4>, 'all': <function all ...
      filename 	'timeline.html'
      fragment 	False
      i 	0
      method 	'xhtml'
      req 	<Request "GET u'/timeline'">
      self 	<trac.web.chrome.Chrome object at 0x91c102c>
      stream 	<genshi.core.Stream object at 0x91cd76c>
      template 	<MarkupTemplate "timeline.html">
      type_ 	'notices'
    * File "/usr/lib/python2.4/site-packages/genshi/core.py", line 128, in __or__
      Code fragment:
       123.
       124. :param function: the callable object that should be applied as a filter
       125. :return: the filtered stream
       126. :rtype: `Stream`
       127. """
       128. return Stream(_ensure(function(self)), serializer=self.serializer)
       129.  
       130. def filter(self, *filters):
       131. """Apply filters to the stream.
       132.
       133. This method returns a new stream with the given filters applied. The
      Local variables:
      Name	Value
      function 	<function inner at 0xb780c454>
      self 	<genshi.core.Stream object at 0x91cd76c>
    * File "/usr/lib/python2.4/site-packages/Trac-0.11.6-py2.4.egg/trac/web/chrome.py", line 848, in inner
      Code fragment:
       843.  
       844. def _filter_stream(self, req, method, filename, stream, data):
       845. def inner(stream, ctxt=None):
       846. for filter in self.stream_filters:
       847. stream = filter.filter_stream(req, method, filename, stream,
       848. data)
       849. return stream
       850. return inner
       851.  
       852. def _stream_location(self, stream):
       853. for kind, data, pos in stream:
      Local variables:
      Name	Value
      ctxt 	None
      data 	{'abs_url_of': <function get_abs_url at 0xb780c1b4>, 'all': <function all ...
      filename 	'timeline.html'
      filter 	<TimelineComponentFilter.TimelineComponentFilterPlugin object at ...
      method 	'xhtml'
      req 	<Request "GET u'/timeline'">
      self 	<trac.web.chrome.Chrome object at 0x91c102c>
      stream 	<genshi.core.Stream object at 0x914c80c>
    * File "/home/trac/Textkernel/plugins/TimelineComponentFilter.py", line 46, in filter_stream
      Code fragment:
        41.  
        42. def filter_stream(self, req, method, filename, stream, data):
        43. if filename == 'timeline.html':
        44. # Insert the new field for entering user names
        45. filter = Transformer('//form[@id="prefs"]/fieldset')
        46. return stream | filter.before(tag.br()) | filter.before(tag.label("Filter Components (none for all): ")) | filter.before(tag.br()) | filter.before(self._components_field_input(req))
        47. return stream
        48.  
        49. def _components_field_input(self, req):
        50. cursor = self.env.get_db_cnx().cursor()
        51. cursor.execute("SELECT name FROM component ORDER BY name")
      Local variables:
      Name	Value
      data 	{'abs_url_of': <function get_abs_url at 0xb780c1b4>, 'all': <function all ...
      filename 	'timeline.html'
      filter 	<genshi.filters.transform.Transformer object at 0x9690434>
      method 	'xhtml'
      req 	<Request "GET u'/timeline'">
      self 	<TimelineComponentFilter.TimelineComponentFilterPlugin object at ...
      stream 	<genshi.core.Stream object at 0x914c80c>
    * File "/home/trac/Textkernel/plugins/TimelineComponentFilter.py", line 51, in _components_field_input
      Code fragment:
        46. return stream | filter.before(tag.br()) | filter.before(tag.label("Filter Components (none for all): ")) | filter.before(tag.br()) | filter.before(self._components_field_input(req))
        47. return stream
        48.  
        49. def _components_field_input(self, req):
        50. cursor = self.env.get_db_cnx().cursor()
        51. cursor.execute("SELECT name FROM component ORDER BY name")
        52. select = tag.select(name="filter-components", id="filter-components", multiple="multiple", size="10")
        53. selectedcomps = []
        54. selectedcomps = req.args.get('filter-components', '')
        55. for component in cursor:
        56. if component[0] in selectedcomps:
      Local variables:
      Name	Value
      cursor 	<trac.db.util.IterableCursor object at 0xb793674c>
      req 	<Request "GET u'/timeline'">
      self 	<TimelineComponentFilter.TimelineComponentFilterPlugin object at ...
    * File "/usr/lib/python2.4/site-packages/Trac-0.11.6-py2.4.egg/trac/db/util.py", line 65, in execute
      Code fragment:
        60. except Exception, e:
        61. self.log.debug('execute exception: %r', e)
        62. raise
        63. if args:
        64. return self.cursor.execute(sql_escape_percent(sql), args)
        65. return self.cursor.execute(sql)
        66.  
        67. def executemany(self, sql, args=None):
        68. if self.log:
        69. self.log.debug('SQL: %r', sql)
        70. try:
      Local variables:
      Name	Value
      args 	None
      self 	<trac.db.util.IterableCursor object at 0xb793674c>
      sql 	'SELECT name FROM component ORDER BY name'
    * File "/usr/lib/python2.4/site-packages/sqlite/main.py", line 233, in execute 

Change History (4)

comment:2 Changed 14 years ago by support@…

This happens when I enable the timelinecomponent plugin. When I comment this line in the .py file : #cursor.execute("SELECT name FROM component ORDER BY name") then I get to see the componentfilter field , of course without components, which is a bummer , because I would like to be able to select a component, but alas, when I uncomment that line , I get the weakly error, instead of the components select view. My svn repo looks like this : <path-to-svn>/Repo/module1

<path-to-svn>/Repo/module2

etc. I would like to view tickets and changesets in the timeline by module , as far as I understand, the component plugin is supposed to do just that, which would be great, if it worked. I allso installed the timelineuser plugin , which works , I can see the changesets/tickets by user , but not by module (yet, hopefully)

Wim

comment:3 Changed 14 years ago by support@…

I changed the .py file to the following :

        db = self.env.get_db_cnx()
        cursor = db.cursor()
        selectedcomps = []
        #cursor = self.env.get_db_cnx().cursor()
        cursor.execute("SELECT name FROM component ORDER BY name")

so , I changed the format of the cursor definition and the location of the declaration of the selectedcomps , now I don't get the RefereneceError anymore , I get to see a components select field , but it's incomplete , only a number of modules are visible and it doesn't do anything when I select a module to view the tickets , the return stream is empty.

comment:4 Changed 14 years ago by support@…

Solved , it shows those modules , which have tickets, it now works

so the only changes necessary were the cursor definition and the location

of the line "selectedcomps = []"

Now to get this working for changesets allso, is that possible ?

comment:5 Changed 13 years ago by Ryan J Ollos

Description: modified (diff)
Note: See TracTickets for help on using tickets.