Should fail sooner when objects and their connections are missused
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ZODB |
New
|
Undecided
|
Unassigned |
Bug Description
A common bug is to store a saved persistent object somewhere disconnected from its connection.
When the object is modified, it gets registered with the connection while the connection is closed.
This leads, typically in an unrelates thread to the dreaded "Cannot close a connection joined to
a transaction" error.
In _register, we should check that the connection is opened and error if it isn't.
It would ne nice to catch errant writes even when a connection is open.
Since 99.999% only one thread uses a connection (in a correct program)
we could check that register is called from the thread that opened a
connection. This would break wildly advanced programs that do
correctly pass connections among threads. We could add a
"multithreaded" option to open to disable this check for people
who think they're smart enough. :)