[issue1193577] add server.shutdown() method and daemon arg to SocketServer

2008-03-01 Thread Jeffrey Yasskin

Jeffrey Yasskin added the comment:

Polling isn't a great way to handle shutdown, since it wastes CPU time
and decreases responsiveness, but it's also easy and my attempt to avoid
it isn't getting anywhere, so I'm planning to fix up your patch a bit
and commit it. Thanks!

I've merged your patch with my conflicting change in the trunk and
re-attached it.

Two things:
1) This patch may interfere with the existing timeout in await_request.
We may be able to re-use that instead of having two select statements.

2) I believe it's important to provide a way to block until the server
isn't accepting any more requests and to block until all active requests
are finished running. If the active requests depend on other bits of the
system, blocking until they're done would help them terminate
gracefully. It would also be useful to give users a more proactive way
to kill active requests, perhaps by listing the handler objects
associated with them (or their PIDs for forking servers). It's
surprisingly complicated to avoid race conditions in these
implementations, especially without support from the Server object.

Added file: http://bugs.python.org/file9579/polling_shutdown.patch

_
Tracker <[EMAIL PROTECTED]>

_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1193577] add server.shutdown() method and daemon arg to SocketServer

2008-02-25 Thread Pedro Werneck

Pedro Werneck added the comment:

I had some code here to do the exact same thing with XML-RPC server. The
patch adds the feature to SocketServer, with a server.shutdown() method
to stop serve_forever(), and change the unittest to use and test the
feature.

I disagree on adding the daemon_threads arg as a keyword to TCPServer
since that's a feature of ThreadingMixIn

--
keywords: +patch
nosy: +werneck
Added file: http://bugs.python.org/file9553/issue1193577.patch

_
Tracker <[EMAIL PROTECTED]>

_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1193577] add server.shutdown() method and daemon arg to SocketServer

2008-02-25 Thread Rafael Zanella

Changes by Rafael Zanella:


--
nosy: +zanella

_
Tracker <[EMAIL PROTECTED]>

_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1193577] add server.shutdown() method and daemon arg to SocketServer

2008-02-23 Thread Jeffrey Yasskin

Jeffrey Yasskin added the comment:

This is getting in my way, so I'll take a look at it. I'm planning to
model the shutdown API after
http://java.sun.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html.
The serve_forever->shutdown interval should probably also be available
through a context manager.

--
assignee: skip.montanaro -> jyasskin
nosy: +jyasskin

_
Tracker <[EMAIL PROTECTED]>

_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com