Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZODB
Commits
09010439
Commit
09010439
authored
Sep 12, 2016
by
Jim Fulton
Committed by
GitHub
Sep 12, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #115 from NextThought/clear-trans-man-on-close
Clear Connection.transaction_manager on close. Fixes #114
parents
163450a9
ca9939eb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
CHANGES.rst
CHANGES.rst
+5
-0
src/ZODB/Connection.py
src/ZODB/Connection.py
+7
-1
src/ZODB/DB.py
src/ZODB/DB.py
+2
-1
No files found.
CHANGES.rst
View file @
09010439
...
@@ -12,6 +12,11 @@
...
@@ -12,6 +12,11 @@
- Call _p_resolveConflict() even if a conflicting change doesn't change the
- Call _p_resolveConflict() even if a conflicting change doesn't change the
state. This reverts to the behaviour of 3.10.3 and older.
state. This reverts to the behaviour of 3.10.3 and older.
- Closing a Connection now reverts its ``transaction_manager`` to
None. This helps prevent errors and release resources when the
``transaction_manager`` was the (default) thread-local manager. See
`issue 114 <https://github.com/zopefoundation/ZODB/issues/114>`_.
5.0.0 (2016-09-06)
5.0.0 (2016-09-06)
==================
==================
...
...
src/ZODB/Connection.py
View file @
09010439
...
@@ -290,7 +290,9 @@ class Connection(ExportImport, object):
...
@@ -290,7 +290,9 @@ class Connection(ExportImport, object):
self
.
_debug_info
=
()
self
.
_debug_info
=
()
if
self
.
opened
:
if
self
.
opened
and
self
.
transaction_manager
is
not
None
:
# transaction_manager could be None if one of the __onCloseCallbacks
# closed the DB already, .e.g, ZODB.connection() does this.
self
.
transaction_manager
.
unregisterSynch
(
self
)
self
.
transaction_manager
.
unregisterSynch
(
self
)
if
primary
:
if
primary
:
...
@@ -313,6 +315,9 @@ class Connection(ExportImport, object):
...
@@ -313,6 +315,9 @@ class Connection(ExportImport, object):
if
am
is
not
None
:
if
am
is
not
None
:
am
.
closedConnection
(
self
)
am
.
closedConnection
(
self
)
# Drop transaction manager to release resources and help prevent errors
self
.
transaction_manager
=
None
def
db
(
self
):
def
db
(
self
):
"""Returns a handle to the database this connection belongs to."""
"""Returns a handle to the database this connection belongs to."""
return
self
.
_db
return
self
.
_db
...
@@ -906,6 +911,7 @@ class Connection(ExportImport, object):
...
@@ -906,6 +911,7 @@ class Connection(ExportImport, object):
c
.
_storage
.
release
()
c
.
_storage
.
release
()
c
.
_storage
=
c
.
_normal_storage
=
None
c
.
_storage
=
c
.
_normal_storage
=
None
c
.
_cache
=
PickleCache
(
self
,
0
,
0
)
c
.
_cache
=
PickleCache
(
self
,
0
,
0
)
c
.
transaction_manager
=
None
##########################################################################
##########################################################################
# Python protocol
# Python protocol
...
...
src/ZODB/DB.py
View file @
09010439
...
@@ -637,6 +637,7 @@ class DB(object):
...
@@ -637,6 +637,7 @@ class DB(object):
@
self
.
_connectionMap
@
self
.
_connectionMap
def
_
(
c
):
def
_
(
c
):
if
c
.
transaction_manager
is
not
None
:
c
.
transaction_manager
.
abort
()
c
.
transaction_manager
.
abort
()
c
.
afterCompletion
=
c
.
newTransaction
=
c
.
close
=
noop
c
.
afterCompletion
=
c
.
newTransaction
=
c
.
close
=
noop
c
.
_release_resources
()
c
.
_release_resources
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment