Where's the bug? (cPickle/thread edition) (was Re: How to optimize and monitor garbage collection?)

Aahz aahz at pythoncraft.com
Sat Nov 20 17:11:30 EST 2010


In article <mailman.214.1287979505.2218.python-list at python.org>,
Steve Holden  <steve at holdenweb.com> wrote:
>
>[aside: in general, if you think your program is not working because of
>a bug in Python, look harder at your program].

Good advice, I certainly agree with you.  But sometimes it's not so
simple.  Right now, my company is running up against a problem with
CherryPy because cPickle.dumps() doesn't release the GIL.  You could
argue that it's our fault for using threads, and you could also argue
that we're having problems because our server has heavy memory
contention (a dumps() that takes a couple of seconds on a laptop takes
more than thirty seconds on the server).

Nevertheless, I think it's also arguably a bug that dumps() doesn't
release the GIL.  (cPickle.dump() *does* release the GIL.)

(Fortunately, we're savvy enough that it's easy for us to just make a
local copy of cPickle that releases the GIL.  Much easier than finding
the problem in the first place...)
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Look, it's your affair if you want to play with five people, but don't
go calling it doubles."  --John Cleese anticipates Usenet



More information about the Python-list mailing list