Modify

Opened 3 years ago

Closed 2 years ago

#8657 closed defect (fixed)

ProgrammingError: Cannot operate on a closed cursor

Reported by: schodet Owned by: rjollos
Priority: normal Component: ExtendedVersionPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Seen on trac 0.11.7.

File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 450, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 227, in dispatch
  data, content_type)
File "/usr/lib/python2.6/dist-packages/trac/web/chrome.py", line 773, in render_template
  stream.render(method, doctype=doctype, out=buffer)
File "/usr/lib/pymodules/python2.6/genshi/core.py", line 183, in render
  return encode(generator, method=method, encoding=encoding, out=out)
File "/usr/lib/pymodules/python2.6/genshi/output.py", line 58, in encode
  for chunk in iterator:
File "/usr/lib/pymodules/python2.6/genshi/output.py", line 339, in __call__
  for kind, data, pos in stream:
File "/usr/lib/pymodules/python2.6/genshi/output.py", line 826, in __call__
  for kind, data, pos in stream:
File "/usr/lib/pymodules/python2.6/genshi/output.py", line 670, in __call__
  for kind, data, pos in stream:
File "/usr/lib/pymodules/python2.6/genshi/output.py", line 771, in __call__
  for kind, data, pos in chain(stream, [(None, None, None)]):
File "/usr/lib/pymodules/python2.6/genshi/output.py", line 586, in __call__
  for ev in stream:
File "/usr/lib/pymodules/python2.6/genshi/core.py", line 288, in _ensure
  for event in stream:
File "/usr/lib/pymodules/python2.6/genshi/core.py", line 288, in _ensure
  for event in stream:
File "/usr/lib/python2.6/dist-packages/trac/web/chrome.py", line 838, in _strip_accesskeys
  for kind, data, pos in stream:
File "/usr/lib/pymodules/python2.6/genshi/core.py", line 288, in _ensure
  for event in stream:
File "/usr/lib/python2.6/dist-packages/trac/web/chrome.py", line 827, in _generate
  for kind, data, pos in stream:
File "/usr/lib/pymodules/python2.6/genshi/core.py", line 288, in _ensure
  for event in stream:
File "/usr/lib/pymodules/python2.6/genshi/core.py", line 288, in _ensure
  for event in stream:
File "/usr/lib/pymodules/python2.6/genshi/filters/transform.py", line 686, in _unmark
  for mark, event in stream:
File "/usr/lib/pymodules/python2.6/genshi/filters/transform.py", line 1152, in __call__
  for subevent in self._inject():
File "/usr/lib/pymodules/python2.6/genshi/filters/transform.py", line 1042, in _inject
  content = content()
File "/usr/local/lib/python2.6/dist-packages/ExtendedVersionTracPlugin-0.0-py2.6.egg/extendedversion/milestone.py", line 83, in apply_version
  return self._version_display(req, buffer.events[1][1])
File "/usr/local/lib/python2.6/dist-packages/ExtendedVersionTracPlugin-0.0-py2.6.egg/extendedversion/milestone.py", line 90, in _version_display
  cursor.execute("SELECT version FROM milestone_version WHERE milestone=%s", (milestone,))
File "/usr/lib/python2.6/dist-packages/trac/db/util.py", line 64, in execute
  return self.cursor.execute(sql_escape_percent(sql), args)
File "/usr/lib/python2.6/dist-packages/trac/db/sqlite_backend.py", line 80, in execute
  result = PyFormatCursor.execute(self, *args)
File "/usr/lib/python2.6/dist-packages/trac/db/sqlite_backend.py", line 59, in execute
  args or [])
File "/usr/lib/python2.6/dist-packages/trac/db/sqlite_backend.py", line 51, in _rollback_on_error
  return function(self, *args, **kwargs)

As a workaround, I temporarily disabled the _version_display function:

  • extendedversion/milestone.py

     
    8686        return stream | filter 
    8787 
    8888    def _version_display(self, req, milestone): 
     89        # XXX not working. 
     90        return [] 
    8991        cursor = self.env.get_db_cnx().cursor() 
    9092        cursor.execute("SELECT version FROM milestone_version WHERE milestone=%s", (milestone,)) 
    9193        row = cursor.fetchone() 

Attachments (0)

Change History (2)

comment:1 Changed 2 years ago by rjollos

  • Owner changed from mestudd to rjollos
  • Status changed from new to assigned

comment:2 Changed 2 years ago by rjollos

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

(In [11249]) Fixes #8657: Prevent database connection from being closed by keeping an explicit database object in scope.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from rjollos. Next status will be 'closed'.
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.