-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError:'NoneType' has no attribute 'get' #26
Comments
Worse than the error, this causes the entire run to hang. ^C won't kill it and I have to resort to ^. |
This appears to be happening because the Connection has been closed. If I adjust the But that doesn't make much sense, because def do_add():
start = time.time()
conn = db.open()
root = conn.root()
m = root['speedtest'][n]
m.update(self.data_to_store)
transaction.commit()
conn.close()
end = time.time()
return end - start So this suggests that |
By the use of
Meanwhile, that same Connection is in use in a different thread. It's concurrently being
So the current hypothesis is that DB.open and Connection.close don't manipulate the connection pool atomically with respect to |
Yup, that's what's happening. There's even a comment in Connection.close() about this: if primary:
for connection in self.connections.values():
if connection is not self:
connection.close(False)
# Return the connection to the pool.
if self.opened is not None:
self._db._returnToPool(self)
1>> # _returnToPool() set self.opened to None.
# However, we can't assert that here, because self may
# have been reused (by another thread) by the time we
# get back here.
else:
self.opened = None
am = self._db._activity_monitor
if am is not None:
am.closedConnection(self)
# Drop transaction manager to release resources and help prevent errors
2>> self.transaction_manager = None Note line 1, where we return the connection to the pool, making it available for re-use. But there is code after that, notably line 2, that modifies the state of the current object, which may have already been reused! |
…ool. Doing so leads to race conditions. In particular, there can be an AttributeError. See zodb/zodbshootout#26 for details.
…ool. Doing so leads to race conditions. In particular, there can be an AttributeError. See zodb/zodbshootout#26 for details.
…ool. Doing so leads to race conditions. In particular, there can be an AttributeError. See zodb/zodbshootout#26 for details. (cherry picked from commit f8cf23e)
…ool. Doing so leads to race conditions. In particular, there can be an AttributeError. See zodb/zodbshootout#26 for details. (cherry picked from commit f8cf23e)
…ool. Doing so leads to race conditions. In particular, there can be an AttributeError. See zodb/zodbshootout#26 for details. (cherry picked from commit f8cf23e)
I see the following error using threads and concurrency=6 under Python 2.7/RS 2.1. So far I've only observed it with MySQL.
The text was updated successfully, but these errors were encountered: