[Stackless] stacklesssocket exception swallowing (was: Buglet in libevent stackless socket).

Estevo euccastro at yahoo.com
Sun Jan 9 06:50:20 CET 2011


>> 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$ 



More information about the Stackless mailing list