Too low max_allowed_packet on server causes crash
MySQL database connector for Python programming
Brought to you by:
adustman
If a MySQL query from Zope fails for the reason that the
max_allowed_packet variable has a to small value on the MySQL
server, the Zope process consumes all available memory and
crashes... (For example if you feed the query with a big chunk
for a BLOB)
My guess is that the 'query' method of the 'DB' object (db.py)
recurses forever if the db connection is hosed. If the second try
fails, I think it should give up.
Logged In: YES
user_id=194813
This diff does the trick for me. (I get an OperationError instead of a
crash.)
--- lib/python/Products/ZMySQLDA/db.py 14 Mar 2002 20:24:54
-0000 1.20
+++ lib/python/Products/ZMySQLDA/db.py 29 Sep 2003 11:32:34
-0000
@@ -310,7 +310,7 @@
r.append(info)
return r
def query(self,query_string, max_rows=1000, retry_on_fail=1):
self._use_TM and self._register()
desc=None
result=()
@@ -339,10 +339,10 @@
self._lock.release()
if m[0] not in hosed_connection: raise
# Hm. maybe the db is hosed. Let's restart it.
db=self.db=apply(self.Database_Connection, (), self.kwargs)
Logged In: YES
user_id=71372
I've been thinking this whole business of trying to re-open
the database and re-submit the query is just wrong,
particularly if you are using transactions. Probably that
whole except clause should go. ZMySQLDA was derived from
ZOracleDA, and that is one of the carryover bits that
probably was not right to begin with, even with Oracle.
Probably it should _abort() instead.
Logged In: YES
user_id=71372
The fix is finally in 2.0.9b3.