MySql connector error
I have a mysqldb connector object based on http://svn.zope.org/mysqldbda/ under zope 2.9.7 Intermittently, I recieve an error *Shouldn't load state for 0xf5f137 when the connection is closed * I implemented this object because the standard mysql database adapter would fail if the connection was idle for some time with a similar kind of error. class MySQLdbAdapter(SimpleItem,ZopeDatabaseAdapter): ... def __call__(self): ... return connection there is an object stored, I call it and return the mysql cursor and use cursor to make queries ala the python module. Does this look famileir to anyone else, if so, how was the error overcome? -Kevin
Le Samedi 25 Août 2007 17:07, Kevin a écrit :
Intermittently, I recieve an error *Shouldn't load state for 0xf5f137 when the connection is closed *
This means there is somewhere a reference to a persistent object which keeps it past transaction commit, which is a bad behaviour.
I implemented this object because the standard mysql database adapter would fail if the connection was idle for some time with a similar kind of error.
I *think* the error you previously got was not the same, but a "conection closed" from regular ZMySQLDA. It is because only the query is protected against such error (it causes a reconnection & query retry), but not the BEGIN query, which is of course issued first and causes the error to go up uncatched. I have a ZMySQLDA version which fixes this problem (an another tricky one), and it should get merged into upstream version in near future. You can grab it on: http://svn.erp5.org/erp5/trunk/products/ZMySQLDA/ Just one remark: a bug has been found in this version which causes problems if multiple connections with the same id exist in different places, due to a pooling mechanism used to fix the tricky bug. It will work just fine if you use site-scope unique ids - as it works for me - but you will get troubles if that's not the case. -- Vincent Pelletier
Your right, the older mysql da I was using gave 'Shouldn't Load State When Connection is Closed'. It turns out that my DA is implemented correctly, but the database cursor is being persisted in another object(past transaction commit) as you noted. So, with some readjusting, the error seems resolvable. Thanks for the explanation! -Kevin Pelletier Vincent wrote:
Le Samedi 25 Août 2007 17:07, Kevin a écrit :
Intermittently, I recieve an error *Shouldn't load state for 0xf5f137 when the connection is closed *
This means there is somewhere a reference to a persistent object which keeps it past transaction commit, which is a bad behaviour.
I implemented this object because the standard mysql database adapter would fail if the connection was idle for some time with a similar kind of error.
I *think* the error you previously got was not the same, but a "conection closed" from regular ZMySQLDA. It is because only the query is protected against such error (it causes a reconnection & query retry), but not the BEGIN query, which is of course issued first and causes the error to go up uncatched. I have a ZMySQLDA version which fixes this problem (an another tricky one), and it should get merged into upstream version in near future. You can grab it on:
http://svn.erp5.org/erp5/trunk/products/ZMySQLDA/
Just one remark: a bug has been found in this version which causes problems if multiple connections with the same id exist in different places, due to a pooling mechanism used to fix the tricky bug. It will work just fine if you use site-scope unique ids - as it works for me - but you will get troubles if that's not the case.
participants (2)
-
Kevin -
Pelletier Vincent