I'm trying to use SQLObject (0.9.3) in conjunction with the threading module. I'm at a bit of a loss as to where to start debugging this one, so I'll present my mini-example and see if others can help. This is using MySQL, with MySQLdb 1.2.2 (latest version) & SQLObject 0.9.3.
class A(SQLObject): class sqlmeta: createSQL = {'mysql': 'ALTER TABLE a ENGINE InnoDB'} cacheValues = False value = IntCol(alternateID=True) def thr1(): for i in range(1000): try: A(value=1) except dberrors.DuplicateEntryError: a = A.byValue(1) for i in range(nthreads): t = threading.Thread(target=thr1,args=()) t.start() If I start 1 thread (nthreads=1), this completes fine. If I start many threads (nthreads=10), I get a bunch of exceptions, with more exceptions, and quicker, if nthreads is large, like 100. The MySQLdb error: Exception _mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now") in <bound method Cursor.__del__ of <MySQLdb.cursors.Cursor object at 0x2a99c68ad0>> ignored is pretty consistent, and sometimes I get an "InterfaceError" from sqlobject. If I change "a = A.byValue(1)" to "pass" the exceptions go away...it seems like the exception puts the connection in a bad state. If I get rid of the InnoDB alter table (and thereby lose row-based locking) then I get lots of the MySQLdb exceptions, with the InnoDB alter table I get only a few. If I change cacheValues to True, w/ InnoDB, I get no significant increase in the number of these exceptions, but they do still occur. I don't see anything especially suspicious if I enable debug and debugOutput. This seems a little similar to the errors at: http://sourceforge.net/tracker/index.php?func=detail&aid=1407684&group_id=74338&atid=540674 but I checked the 0.9.3 code and this patch is applied. Can anyone offer any insight? Thanks, nathan ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss