473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

SocketServer.ForkingMixIn and zombie processes

Hi,

I noticed that when I used SocketServer.ForkingMixIn
(ForkingTCPServer), there were always zombie processes around. I
searched for where waitpid() is called in ForkingMixIn and found it in
SocketServer.py:

def process_request(self, request, client_address):
"""Fork a new subprocess to process the request."""
self.collect_children()
pid = os.fork()
if pid:
# Parent process
if self.active_children is None:
self.active_children = []
self.active_children.append(pid)
self.close_request(request)
return
else:
# Child process.
# This must never return, hence os._exit()!
try:
self.finish_request(request, client_address)
os._exit(0)
except:
try:
self.handle_error(request, client_address)
finally:
os._exit(1)

So waitpid() is called just before fork(). This means that if next
request does not come in, zombie processes are not reclaimed forever!
Is this an intentional behavior? Is there any workaround?

--
Kazu Nisimura

Feb 28 '07 #1
0 1322

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Olivier Hoarau | last post by:
Hello, I have build a client/server application with the socket module. The server mades UDP broadcasting and the client only reads UDP broadcast messages. All work fine. Now I want to use for...
0
by: Adil Hasan | last post by:
Hello Fred, I just ran across your question. I think that the following code will work: ----- SERVER CODE ------ import SocketServer import time class...
1
by: Brian | last post by:
From one script, I'm spawnv'ing another that will launch mpg123 to play a specified mp3. Problem is that After the second script has launched mpg123, it'll turn into a zombie process. It doesn't...
5
by: missiplicity | last post by:
Hi, I am newbie to Python language and am taking my baby steps. I am using Python2.4 from ActiveState on W2K. I am trying to create a simple SocketServer program. Just adding the following 2 lines...
12
by: Paul Rubin | last post by:
Let's say you have a SocketServer with the threading mix-in and you run serve_forever on it. How can you shut it down, or rather, how can it even shut itself down? Even if you use a...
4
by: A. Tillman | last post by:
We are having a really big problem with a zombie process/transaction that is blocking other processes. When looking at Lock/ProcessID under Current Activity I see a bunch of processes that are...
1
by: rbt | last post by:
I've read more about sockets and now, I have a better understanding of them. However, I still have a few SocketServer module questions: When used with SocketServer how exactly does...
0
by: Reid Priedhorsky | last post by:
Dear all, I have a TCP server written using SocketServer with ForkingMixIn. Servicing connections is CPU-bound and can take several seconds. I now need a way to safely tell the master process...
4
by: Johny | last post by:
To get a number of the http processes running on my Linux( Debia box) I use ps -ef | grep "ttpd" | wc -l But If I want to use to get a number of the http processes from my Python program I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.