Modify ↓
#11115 closed defect (fixed)
Cannot operate on closed cursor
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | BookmarkPlugin |
Severity: | normal | Keywords: | ProgrammingError, closed, cursor |
Cc: | Jun Omae, Ryan J Ollos | Trac Release: |
Description
While testing with Trac 0.11, I've seen the following in the logs:
11:17:19 AM Trac[main] ERROR: Cannot operate on a closed cursor. Traceback (most recent call last): File "/home/user/Workspace/th11043/trac-0.11/trac/web/main.py", line 233, in dispatch self._post_process_request(req) File "/home/user/Workspace/th11043/trac-0.11/trac/web/main.py", line 301, in _post_process_request f.post_process_request(req, *(None,)*extra_arg_count) File "/home/user/Workspace/trachacks.git/bookmarkplugin/trunk/tracbookmark/__init__.py", line 183, in post_process_request self.render_bookmarker(req) File "/home/user/Workspace/trachacks.git/bookmarkplugin/trunk/tracbookmark/__init__.py", line 335, in render_bookmarker menu = self._get_bookmarks_menu(req) File "/home/user/Workspace/trachacks.git/bookmarkplugin/trunk/tracbookmark/__init__.py", line 342, in _get_bookmarks_menu for url, name, username in self.get_bookmarks(req): File "/home/user/Workspace/th11043/trac-0.11/trac/db/util.py", line 40, in __iter__ row = self.cursor.fetchone() ProgrammingError: Cannot operate on a closed cursor.
The error occurs when loading any page, such as WikiStart. I think we shouldn't be returning a cursor
from get_bookmarks
.
Attachments (0)
Change History (4)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Owner: | changed from yosiyuki to Ryan J Ollos |
---|---|
Status: | new → assigned |
Thanks! Initially I had just called fetchall
on the cursor, but returning an iterator is probably better.
comment:3 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:4 Changed 11 years ago by
Cc: | Ryan J Ollos added |
---|---|
Keywords: | ProgrammingError closed cursor added |
Note: See
TracTickets for help on using
tickets.
Indeed. We must keep the
db
variable while in use ofcursor
. See https://groups.google.com/forum/?fromgroups#!msg/trac-dev/trRtzv5waoQ/Uz1T1sBhTR8J and http://trac.edgewall.org/changeset/8878.tracbookmark/__init__.py