[Stackless] stacklesssocket exception swallowing (was: Buglet in libevent stackless socket).
Kristján Valur Jónsson
kristjan at ccpgames.com
Fri Jan 14 06:28:00 CET 2011
>From your repro, I see no evidence of a TaskletExit:
es at duna:~/burrotron$ sp test-socket.py sls
um- connected?
es at duna:~/burrotron$
The fact that you print "um- connected?" indicates insead that connect() returned _without_ an exception.
So, there are a few things that can be failing:
1) the blocking connect() call (done after the select()) call isn't failing so there is no exception being raised
2) The exception is being sent to the target socket using tasklet.send_exception() but is not being raised on the receiving side
3) The exception is being handled somewhere on the receiving side.
My money is on 1. I think that this is simply a case of not detection the connection failure properly on unix.
K
-----Original Message-----
From: stackless-bounces at stackless.com [mailto:stackless-bounces at stackless.com] On Behalf Of Estevo
Sent: Sunday, January 09, 2011 13:50
To: stackless at stackless.com
Subject: [Stackless] stacklesssocket exception swallowing (was: Buglet in libevent stackless socket).
>> By the way, the reason why I checked out this version of the
>> stackless socket
>> was because the standard one wasn't reporting any socket exceptions to me.
>> Instead it would exit silently (raising TaskletExit, which is not
>> normally
>> reported) if, for example, if the server refused my connection. This
>> is in Python 2.6. If this is not a known issue, I'll write a more
>> detailed reproduction description.
>
> When did you last try it?
>
> European Service Network kindly sponsored me to do some work on it
> late last year, and it now passes the Python 2.7 unit test suite.
> And there have been further fixes in the last week based on its use
> here at C.C.P., including fixes related to exception swallowing.
I tried again downloading (what I believe to be) last stackless socket from
here:
http://stacklessexamples.googlecode.com/svn/trunk/examples/networking/stacklesssocket.py
and the libevent version from here:
http://stacklessexamples.googlecode.com/svn/trunk/examples/networking/socketlibevent.py
I wrote this little test script:
--- BEGIN test-socket.py
import sys
import stackless
def connect():
if sys.argv[1] == 'sls':
import stacklesssocket
stacklesssocket.install()
elif sys.argv[1] == 'lev':
import socketlibevent
sys.modules['socket'] = socketlibevent
else:
assert sys.argv[1] == 'std'
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('127.0.0.1', 6789))
print "um- connected?"
stackless.tasklet(connect)()
stackless.run()
--- END test-socket.py
My computer is accepting no connections on port 6789. This is just to test a connection refused error.
This is the banner of my stackless python installation, which I invoke as sp:
Python 2.6.4 Stackless 3.1b3 060516 (python-2.64:78555M, May 3 2010, 18:33:09) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.
>>>
As you see, it's Python 2.6, not 2.7.
This is my test of the unpatched module:
es at duna:~/burrotron$ sp test-socket.py std
Traceback (most recent call last):
File "test-socket.py", line 19, in <module>
stackless.run()
File "test-socket.py", line 15, in connect
s.connect(('127.0.0.1', 6789))
File "<string>", line 1, in connect
socket.error: [Errno 111] Connection refused
This is my test of the libevent-based stackless socket:
es at duna:~/burrotron$ sp test-socket.py lev
Traceback (most recent call last):
File "test-socket.py", line 19, in <module>
stackless.run()
File "test-socket.py", line 15, in connect
s.connect(('127.0.0.1', 6789))
File "/home/es/burrotron/socketlibevent.py", line 160, in connect
return self.sock.connect(address)
File "<string>", line 1, in connect
socket.error: [Errno 111] Connection refused
This is my run using the standard stacklesssocket.py:
es at duna:~/burrotron$ sp test-socket.py sls
um- connected?
es at duna:~/burrotron$
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless
More information about the Stackless
mailing list