Issue1347

classification
Title: socket Level 6 not supported
Type: Severity: normal
Components: Library Versions: 2.5b1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: amak Nosy List: Christof, amak
Priority: Keywords:

Created on 2009-05-13.11:06:12 by Christof, last changed 2009-05-18.19:18:25 by Christof.

Messages
msg4681 (view) Author: Christof (Christof) Date: 2009-05-13.11:06:11
(I try to run web.py with Jython 2.5rc2 but have 2 problems (the other
with transformer put as another issue).

I use the basic example on http://webpy.org/ (folder web with the source
is in on the path). During server startup I get the following output:

http://0.0.0.0:8080/
Traceback (most recent call last):
  File "1.py", line 22, in <module>
    app.run()
  File "I:\dev-a-workspace\dev\jywebpy\web\application.py", line 289, in run
    return wsgi.runwsgi(self.wsgifunc(*middleware))
  File "I:\dev-a-workspace\dev\jywebpy\web\wsgi.py", line 54, in runwsgi
    return httpserver.runsimple(func, validip(listget(sys.argv, 1, '')))
  File "I:\dev-a-workspace\dev\jywebpy\web\httpserver.py", line 223, in
runsimpl
e
    server.start()
  File "I:\dev-a-workspace\dev\jywebpy\web\httpserver.py", line 223, in
runsimpl
e
    server.start()
  File "I:\dev-a-workspace\dev\jywebpy\web\wsgiserver\__init__.py", line
1589, i
n start
    self.socket.listen(self.request_queue_size)
  File "<string>", line 1, in listen
  File "I:\dev-a-workspace\dev\jywebpy\socket.py", line 788, in listen
    self._config()
  File "I:\dev-a-workspace\dev\jywebpy\socket.py", line 788, in listen
    self._config()
  File "I:\dev-a-workspace\dev\jywebpy\socket.py", line 727, in _config
    self.sock_impl.setsockopt(level, optname, self.pending_options[
(level, optn
ame) ])
  File "I:\dev-a-workspace\dev\jywebpy\socket.py", line 248, in setsockopt
    raise error(errno.ENOPROTOOPT, "Level %d option not supported on
socket(%s):
 %d" % (level, str(self.jsocket), option))
socket.error: (43, 'Level 6 option not supported on
socket(ServerSocket[addr=/0.
0.0.0,localport=8080]): 256')

I have no real idea what is going on in socket module but after adding
"if level == 6: continue" in line 721 (so simple removing this level) at
least the web.py server does seem to start properly.

Please excuse my naivity, hope this is not complete bullshit...
msg4686 (view) Author: Alan Kennedy (amak) Date: 2009-05-15.16:52:17
Are you using a version of socket.py that you have modified yourself?

I notice from your traceback that you have a local copy of socket.py in
webpy/web/socket.py?

The self._config() call in the _listen() method is on line 783 in the
version of socket.py released with RC2, whereas your traceback gives it
as being on line 788?

If you have modified your local copy of socket.py, it will not be
possible for me to determine why this is happening.

Although I guess that you have added some socket options to your local
copy of socket.py? (I must improve that error message).

If you have a local copy of socket.py, please attach it to this bug
report so that I can get a look at it.
msg4689 (view) Author: Christof (Christof) Date: 2009-05-15.17:02:02
I have used the socket.py from Jython 2.5rc2's Lib/site-packages
directory and copied it to my local path as I did not wanted to change
to lib. I only added the additional line "if level == 6: continue" to
test if I could get any further with my attempt to run web.py. Hope that
helps...
msg4691 (view) Author: Alan Kennedy (amak) Date: 2009-05-17.20:49:12
This error is happening because webpy is trying to set the socket option
TCP_NODELAY on a server socket, which is not supported on java, and thus
jython.

I have checked in a change to error reporting for this situation, so
that the error message gives the names of the option constants involved
in the error, rather than the symbolic constants, which were obviously
confusing.

The change was made at revision 6354. You can download the updated
version from 

http://fisheye3.atlassian.com/browse/jython/trunk/jython/Lib/socket.py

Looking at the webpy code, I see that the option is set on line 1610 of
file "web/wsgiserver/__init__.py" of the current release. This is only
done if the "nodelay" option is set true. So if you set that option to
False, then the TCP_NODELAY option is not set, thus preventing this problem.

You may want to report this as a bug to the webpy folks, since
unsupported socket options on jython give an exception.
msg4696 (view) Author: Christof (Christof) Date: 2009-05-18.19:18:24
great, thanks a lot!
History
Date User Action Args
2009-05-18 19:18:25Christofsetmessages: + msg4696
2009-05-17 20:49:13amaksetstatus: open -> closed
resolution: fixed
messages: + msg4691
2009-05-15 17:02:02Christofsetmessages: + msg4689
2009-05-15 16:52:18amaksetassignee: amak
messages: + msg4686
nosy: + amak
2009-05-13 11:06:12Christofcreate