
Hi Guys, What is the status of integrating timeoutsocket.py into standard library? Are there any body responsible for it currently? If not I would like to give it a shot. Bernie -- There are three schools of magic. One: State a tautology, then ring the changes on its corollaries; that's philosophy. Two: Record many facts. Try to find a pattern. Then make a wrong guess at the next fact; that's science. Three: Be aware that you live in a malevolent Universe controlled by Murphy's Law, sometimes offset by Brewster's Factor; that's engineering. -- Robert A. Heinlein

Isn't one of the problems that the timeout is global? Also, I'd expect that if you did this as a standard feature, the implementation would be completely different (e.g. integrate it in the C socket code). I think it would be great if timeouts were added to sockets (and *maybe* the global timeout is even a good thing). But I'd like to see a design first rather than code. --Guido van Rossum (home page: http://www.python.org/~guido/)

Guido van Rossum wrote:
It is indeed. IMO, Timeout should be per-socket based.
Yes, because I find that there is a need for that (I needed it quite frequently).
So it looks like nobody is working on it, I will try to create a design and summited it for comment.
--Guido van Rossum (home page: http://www.python.org/~guido/)
Bernie -- There are three schools of magic. One: State a tautology, then ring the changes on its corollaries; that's philosophy. Two: Record many facts. Try to find a pattern. Then make a wrong guess at the next fact; that's science. Three: Be aware that you live in a malevolent Universe controlled by Murphy's Law, sometimes offset by Brewster's Factor; that's engineering. -- Robert A. Heinlein

So it looks like nobody is working on it, I will try to create a design and summited it for comment.
Excellent! --Guido van Rossum (home page: http://www.python.org/~guido/)

>> What is the status of integrating timeoutsocket.py into standard >> library? Are there any body responsible for it currently? If not I >> would like to give it a shot. Guido> Isn't one of the problems that the timeout is global? That's the easiest way to use it, but you can specify timeouts on a per-socket basis. From the module docstring: import timeoutsocket import httplib H = httplib.HTTP("www.python.org") H.sock.set_timeout(30) The author, Tim O'Malley, is probably the best person to address issues with this package, so I've added him to the cc list in case he's not a python-dev subscriber. Skip

Skip Montanaro wrote:
Just have a look at socket.py and timeoutsocket.py (version 1.21, assuming the lastest). Looks like that class _socketobject and class Timeoutsocket can be merged with no conflict. Now it comes the question: 1. Shall we merge socket.py and timeoutsocket.py? 2. If yes to Q1, how are we going to due with the copyright issue? 3. If no to Q1, are we going to just add timeoutsocket.py to standard library (Though there the copyright issue stays)? Bernie -- In Scotland, a new game was invented. It was entitled Gentlemen Only Ladies Forbidden.... and thus the word GOLF entered into the English language.

Let's ask Tim O'Malley if he's willing to assign the code the the PSF using something like this form: http://www.python.org/psf/psf-contributor-agreement.html --Guido van Rossum (home page: http://www.python.org/~guido/)

hola. I've taken a whack at option #1 (grand unification of socket and timeoutsocket). It's larger than I'd prefer to send in email. If you are interested: http://www.timo-tasi.org/python/socket.py -- TimO "Create like a God, Command like a King, and Work like a slave" -- Brancusi

Timothy O'Malley wrote:
Tim, this is a complete rewrite of timeoutsocket.py. It is quite an effort :)
I agree on the performance issue. Over the past two weeks, Michael Gilfix and I moved ahead with the implementing of timeout socket in C level. Michael translates what you've done in timeoutsocket.py and put it into socket.c. So far we did nothing to TimeoutFile. The proposed patch is basically done (except for the test case). You can find it on http://www.3captus.com/Downloads/. We are now working on the test case for connect() and sendfoo(). Currently, test for connect() is done by trying a timeout connect to an external site (same to what you've done). However, we wanted to remove the external dependency on standard python test suit. So far no luck of make it working, and I cannot make sendfoo() to raise timeout error at all. Would you like to help us with the test? Bernie -- There are three schools of magic. One: State a tautology, then ring the changes on its corollaries; that's philosophy. Two: Record many facts. Try to find a pattern. Then make a wrong guess at the next fact; that's science. Three: Be aware that you live in a malevolent Universe controlled by Murphy's Law, sometimes offset by Brewster's Factor; that's engineering. -- Robert A. Heinlein

hola. That's awesome that you put the timeout functionality into the C-level socket module. I'd vote that it is "The Right"(tm) way to include this feature in the standard library. You guys rock! I couldn't get to the web site you indicated, so pardon this question if I could have found the answer on-line somewhere. How did you handle the _fileobject class in the standard socket.py? The version in Python-2.2 will lose data if the underlying socket raises an exception during a read() or readlines(). Basically, these two routines use a local variable to store the incoming data -- and that local variable will go out of scope after the exception during recv(). I believe that the TimeoutFile class in the socket.py version I thew together fixes this issue. Of course, you may have already noticed and fixed this, too. Again, very awesome! -- TimO "Everything I did in life that was worthwhile I caught hell for." - former U.S. Supreme Court Chief Justice Earl Warren

Timothy O'Malley wrote:
[snip]
I couldn't get to the web site you indicated, so pardon this question if I could have found the answer on-line somewhere.
The site was down <sign>. IS is now back up.
How did you handle the _fileobject class in the standard socket.py?
We didn't.
I'll modify the test case to see what happens.
So it is why TimeoutFile was there in the first place. Bernie -- There are three schools of magic. One: State a tautology, then ring the changes on its corollaries; that's philosophy. Two: Record many facts. Try to find a pattern. Then make a wrong guess at the next fact; that's science. Three: Be aware that you live in a malevolent Universe controlled by Murphy's Law, sometimes offset by Brewster's Factor; that's engineering. -- Robert A. Heinlein

Timothy O'Malley wrote:
Looks nice. One quirk: the 32k constant in the implementation should probably be turned into a class attribute. Depending on the network being used, this would be a parameter to tweak to increase throughput. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/

Isn't one of the problems that the timeout is global? Also, I'd expect that if you did this as a standard feature, the implementation would be completely different (e.g. integrate it in the C socket code). I think it would be great if timeouts were added to sockets (and *maybe* the global timeout is even a good thing). But I'd like to see a design first rather than code. --Guido van Rossum (home page: http://www.python.org/~guido/)

Guido van Rossum wrote:
It is indeed. IMO, Timeout should be per-socket based.
Yes, because I find that there is a need for that (I needed it quite frequently).
So it looks like nobody is working on it, I will try to create a design and summited it for comment.
--Guido van Rossum (home page: http://www.python.org/~guido/)
Bernie -- There are three schools of magic. One: State a tautology, then ring the changes on its corollaries; that's philosophy. Two: Record many facts. Try to find a pattern. Then make a wrong guess at the next fact; that's science. Three: Be aware that you live in a malevolent Universe controlled by Murphy's Law, sometimes offset by Brewster's Factor; that's engineering. -- Robert A. Heinlein

So it looks like nobody is working on it, I will try to create a design and summited it for comment.
Excellent! --Guido van Rossum (home page: http://www.python.org/~guido/)

>> What is the status of integrating timeoutsocket.py into standard >> library? Are there any body responsible for it currently? If not I >> would like to give it a shot. Guido> Isn't one of the problems that the timeout is global? That's the easiest way to use it, but you can specify timeouts on a per-socket basis. From the module docstring: import timeoutsocket import httplib H = httplib.HTTP("www.python.org") H.sock.set_timeout(30) The author, Tim O'Malley, is probably the best person to address issues with this package, so I've added him to the cc list in case he's not a python-dev subscriber. Skip

Skip Montanaro wrote:
Just have a look at socket.py and timeoutsocket.py (version 1.21, assuming the lastest). Looks like that class _socketobject and class Timeoutsocket can be merged with no conflict. Now it comes the question: 1. Shall we merge socket.py and timeoutsocket.py? 2. If yes to Q1, how are we going to due with the copyright issue? 3. If no to Q1, are we going to just add timeoutsocket.py to standard library (Though there the copyright issue stays)? Bernie -- In Scotland, a new game was invented. It was entitled Gentlemen Only Ladies Forbidden.... and thus the word GOLF entered into the English language.

Let's ask Tim O'Malley if he's willing to assign the code the the PSF using something like this form: http://www.python.org/psf/psf-contributor-agreement.html --Guido van Rossum (home page: http://www.python.org/~guido/)

hola. I've taken a whack at option #1 (grand unification of socket and timeoutsocket). It's larger than I'd prefer to send in email. If you are interested: http://www.timo-tasi.org/python/socket.py -- TimO "Create like a God, Command like a King, and Work like a slave" -- Brancusi

Timothy O'Malley wrote:
Tim, this is a complete rewrite of timeoutsocket.py. It is quite an effort :)
I agree on the performance issue. Over the past two weeks, Michael Gilfix and I moved ahead with the implementing of timeout socket in C level. Michael translates what you've done in timeoutsocket.py and put it into socket.c. So far we did nothing to TimeoutFile. The proposed patch is basically done (except for the test case). You can find it on http://www.3captus.com/Downloads/. We are now working on the test case for connect() and sendfoo(). Currently, test for connect() is done by trying a timeout connect to an external site (same to what you've done). However, we wanted to remove the external dependency on standard python test suit. So far no luck of make it working, and I cannot make sendfoo() to raise timeout error at all. Would you like to help us with the test? Bernie -- There are three schools of magic. One: State a tautology, then ring the changes on its corollaries; that's philosophy. Two: Record many facts. Try to find a pattern. Then make a wrong guess at the next fact; that's science. Three: Be aware that you live in a malevolent Universe controlled by Murphy's Law, sometimes offset by Brewster's Factor; that's engineering. -- Robert A. Heinlein

hola. That's awesome that you put the timeout functionality into the C-level socket module. I'd vote that it is "The Right"(tm) way to include this feature in the standard library. You guys rock! I couldn't get to the web site you indicated, so pardon this question if I could have found the answer on-line somewhere. How did you handle the _fileobject class in the standard socket.py? The version in Python-2.2 will lose data if the underlying socket raises an exception during a read() or readlines(). Basically, these two routines use a local variable to store the incoming data -- and that local variable will go out of scope after the exception during recv(). I believe that the TimeoutFile class in the socket.py version I thew together fixes this issue. Of course, you may have already noticed and fixed this, too. Again, very awesome! -- TimO "Everything I did in life that was worthwhile I caught hell for." - former U.S. Supreme Court Chief Justice Earl Warren

Timothy O'Malley wrote:
[snip]
I couldn't get to the web site you indicated, so pardon this question if I could have found the answer on-line somewhere.
The site was down <sign>. IS is now back up.
How did you handle the _fileobject class in the standard socket.py?
We didn't.
I'll modify the test case to see what happens.
So it is why TimeoutFile was there in the first place. Bernie -- There are three schools of magic. One: State a tautology, then ring the changes on its corollaries; that's philosophy. Two: Record many facts. Try to find a pattern. Then make a wrong guess at the next fact; that's science. Three: Be aware that you live in a malevolent Universe controlled by Murphy's Law, sometimes offset by Brewster's Factor; that's engineering. -- Robert A. Heinlein

Timothy O'Malley wrote:
Looks nice. One quirk: the 32k constant in the implementation should probably be turned into a class attribute. Depending on the network being used, this would be a parameter to tweak to increase throughput. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/
participants (5)
-
Bernard Yue
-
Guido van Rossum
-
M.-A. Lemburg
-
Skip Montanaro
-
Timothy O'Malley