473,807 Members | 2,854 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SocketServer.Fo rkingMixIn and zombie processes

Hi,

I noticed that when I used SocketServer.Fo rkingMixIn
(ForkingTCPServ er), 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_ch ildren()
pid = os.fork()
if pid:
# Parent process
if self.active_chi ldren is None:
self.active_chi ldren = []
self.active_chi ldren.append(pi d)
self.close_requ est(request)
return
else:
# Child process.
# This must never return, hence os._exit()!
try:
self.finish_req uest(request, client_address)
os._exit(0)
except:
try:
self.handle_err or(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 1342

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

Similar topics

3
4173
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 the same thing the socketserver module, it's ok for the client, but I don't succeed in making work the server :-(( Here is the client (which works)
0
2945
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 GreetingHandler(SocketServer.BaseRequestHandler): '''Class to handle sending a greeting to a client '''
1
1996
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 happen when I launch it from the command line, so there's something wrong with the way I'm calling it (I believe). mp3pid = os.spawnv(os.P_NOWAIT, "/oter/playfile.py", ) Shouldn't this launch the script without waiting for it to finish?
5
2680
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 of code in the program result in the errors given below: import SocketServer print "SocketServer imported"
12
13410
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 handle_request loop instead of serve_forever, it still seems difficult: class myserver(ThreadingMixIn, TCPServer): pass server = myserver(...) server.shutdown = False while not server.shutdown: server.handle_request()
4
7737
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 blocked by process 94 and process 94 is blocked by process -2. I assume -2 is a zombie that has an open transaction. I cannot find this process to kill and it seems that this transaction is surviving database restarts. I know which table is...
1
1610
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 socket.setdefaulttimeout() work? Does it timeout the initial connect request to the socket server or does it timeout the session between the connecting client socket and the client socket the server generated to handle the incoming request? Also, since the...
0
1025
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 to update its state (by groveling in a PostgreSQL database, potentially for several seconds). How can I do this safely? I thought of two ways:
4
1571
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 must use a popen command e.g. popen2.popen3('ps -ef | grep "ttpd" | wc -l') that is I must call an external command from Python. But it creates a zombie.
0
9720
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10626
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10112
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9193
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4330
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3854
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.