[DB-SIG] MySQL error 2013, 'Lost connection to MySQL server during query'

Chris Cogdon chris at cogdon.org
Tue May 20 15:16:57 EDT 2003

On Tuesday, May 20, 2003, at 13:09 US/Pacific, Lloyd Kvam wrote:

> I have not been closing cursors, but simply leaving them to get garbage
> collected.  I have not been reusing cursors for successive queries.

That's probably your problem there. If the DBAPI needs to keep track of 
which cursors are open, then there's a cycle that can only be broken by 
manually indicating when you dont need the cursor anymore (via a 

On examining the pyPgSQL API, there's no warnings about having to 
manually close cursors when they're done. The API you're using may have 
the problem, though, so if you could somehow test the fact that would 
go a long way to diagnosing the problem.

(Perhaps subclassing the cursor object, and override the 'cursor' 
method of the database object to give you the subclassed object 
instead, and then print a message when the cursor's closed)

    ("`-/")_.-'"``-._        Chris Cogdon <chris at cogdon.org>
     . . `; -._    )-;-,_`)
    (v_,)'  _  )`-.\  ``-'
   _.- _..-_/ / ((.'
((,.-'   ((,/   fL

More information about the DB-SIG mailing list