Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > SocketServer shutdown deadlock

Reply
Thread Tools

SocketServer shutdown deadlock

 
 
Okko Willeboordse
Guest
Posts: n/a
 
      11-06-2008
All,

With Python 2.5 SocketServer features the shutdown method that can be
called from another thread to stop the serve_forever loop.

However;

When the shutdown method is called before serve_forever, shutdown will
never return.
This can happen when a server is stopped during startup.

In other words, the following program shouldn't hang but it does;

import SocketServer

server = SocketServer.ThreadingTCPServer(("127.0.0.1", 12345),
SocketServer.BaseRequestHandler)
server.shutdown()

What to do?
 
Reply With Quote
 
 
 
 
Okko Willeboordse
Guest
Posts: n/a
 
      11-06-2008
If I wait until _BaseServer__serving is True before calling shutdown
things go better.



Okko Willeboordse wrote:
> All,
>
> With Python 2.5 SocketServer features the shutdown method that can be
> called from another thread to stop the serve_forever loop.
>
> However;
>
> When the shutdown method is called before serve_forever, shutdown will
> never return.
> This can happen when a server is stopped during startup.
>
> In other words, the following program shouldn't hang but it does;
>
> import SocketServer
>
> server = SocketServer.ThreadingTCPServer(("127.0.0.1", 12345),
> SocketServer.BaseRequestHandler)
> server.shutdown()
>
> What to do?


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic SocketServer & Thread Question john Java 4 06-03-2005 05:03 PM
SocketServer accept() fails to work (Linux) Janusz Java 4 06-01-2004 12:44 PM
socketserver and postgres Liam Slusser Python 0 10-06-2003 09:55 PM
_socket / SocketServer / Mandrake Linux problem / Python 2.3 Barry Sprajc Python 1 08-03-2003 06:09 PM
SocketServer class - basis problem lebo Python 4 06-24-2003 01:42 PM



Advertisments