Python server locks up

Z

Zac Burns

I have a server running Python 2.6x64 which after running for about a
month decides to lock up and become unresponsive to all threads for
several minutes at a time. While it is locked up Python proceeds to
consume large amounts of continually increasing memory.

The basic function of the server is to serve a large dictionary -
somewhat like a database. I have a couple theories as to why it locks
up, but I'm not sure how to test them.

Theories:
Python is resizing the large dictionary
Python is garbage collecting

How would you suggest to figure out what is the problem?

--
Zachary Burns
(407)590-4814
Aim - Zac256FL
Production Engineer (Digital Overlord)
Zindagi Games
 
S

sturlamolden

Theories:
   Python is resizing the large dictionary
   Python is garbage collecting

Python uses reference counting, not a generational GC like Java. A
Python object is destroyed when the refcount drops to 0. The GC only
collects cyclic references. If you create none, there are no GC delays
(you can in fact safely turn the GC off). Python does not share Java's
nasty habit of having long GC delays.
 
P

Paul Rubin

sturlamolden said:
Python uses reference counting, not a generational GC like Java. A
Python object is destroyed when the refcount drops to 0. The GC only
collects cyclic references. If you create none, there are no GC delays
(you can in fact safely turn the GC off). Python does not share Java's
nasty habit of having long GC delays.

If you drop the last reference to a large object (say a billion item
dictionary), then Python can pause for quite a long time freeing
all the constituents of that object.
 
T

Terry Reedy

sturlamolden said:
Python uses reference counting, not a generational GC like Java.

The CPython implementation, that is. Jython, built on top of Java, uses
Java's GC. Ditto for IronPython implementation. PyPY may allow some choice.

A
 
D

Dave Angel

Paul said:
If you drop the last reference to a large object (say a billion item
dictionary), then Python can pause for quite a long time freeing
all the constituents of that object.
(Both of these messages refer to an implementation, CPython, not the
language Python.)

The key difference is that CPython "pauses" at a deterministic point in
the code, because of something the program has specified, rather than at
a point when some system measurement decides that now would be a good
time for gc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,809
Latest member
moe77

Latest Threads

Top