Issue2435
Created on 2015-11-23.20:32:53 by zyasoft, last changed 2015-12-21.18:08:51 by zyasoft.
msg10498 (view) |
Author: Jim Baker (zyasoft) |
Date: 2015-11-23.20:32:52 |
|
Jython 2.5 quietly ignores setting unsupported socket options like socket.SO_EXCLUSIVEADDRUSE (which were marked as negative to indicate they were unsupported). But in 2.7 this will raise a socket.error with errno.ENOPROTOOPT.
I believe 2.7 is correct, but we also have codebases that use the standard Python idiom of testing for the existence of a name, then attempting to use if defined. This means we should also remove these unsupported options - in particular, socket.SO_EXCLUSIVEADDRUSE is not defined on non Windows platforms on CPython as seen here when run on OS X 10.11:
$ python
Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.SO_EXCLUSIVEADDRUSE
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'SO_EXCLUSIVEADDRUSE'
This problem is seen in running the test suite for Pyro4.
|
msg10501 (view) |
Author: Jim Baker (zyasoft) |
Date: 2015-11-23.21:26:13 |
|
Specifically this means removing one or more of the following socket options:
SO_DEBUG = -1
SO_DONTROUTE = -1
SO_EXCLUSIVEADDRUSE = -8
SO_RCVLOWAT = -16
SO_RCVTIMEO = -32
SO_REUSEPORT = -64
SO_SNDLOWAT = -128
SO_SNDTIMEO = -256
SO_USELOOPBACK = -512
It's possible that the more conservative option is to just remove socket.SO_EXCLUSIVEADDRUSE - it only applies to Windows.
More info on portability can be found. See for example this great Stack Overflow answer on SO_REUSEPORT - http://stackoverflow.com/a/14388707/423006
|
msg10504 (view) |
Author: Jim Baker (zyasoft) |
Date: 2015-11-23.22:41:13 |
|
See discussion here: http://sourceforge.net/p/jython/mailman/message/34642295/
|
msg10505 (view) |
Author: Jim Baker (zyasoft) |
Date: 2015-11-23.22:50:19 |
|
Removed socket.SO_EXCLUSIVEADDRUSE as of https://hg.python.org/jython/rev/f528d540f4b3
We can look at other unsupported socket options later as they come up, but let's mark this as fixed - no need to have a "permanent review bug". As I see it after today's review on jython-users and looking at the related Java bugs, this is likely a special case, and it's also possible that we could support a number of these options like SO_SNDTIMEO via appropriate emulation using Netty's rather powerful semantics.
|
msg10516 (view) |
Author: Darjus Loktevic (darjus) |
Date: 2015-12-08.01:25:43 |
|
Hey Jim,
Not sure this is the root cause but regrtest is now failing:
[exec] test test_socket_jy failed -- Traceback (most recent call last):
[exec] File "/Users/darjus/Documents/jython/dist/Lib/test/test_socket_jy.py", line 72, in test_connect_ex_workout
[exec] self.assertEqual(result[-1], errno.EISCONN)
[exec] AssertionError: 37 != 56
|
msg10531 (view) |
Author: Jim Baker (zyasoft) |
Date: 2015-12-11.02:42:15 |
|
Darjus, is that failure intermittent? We are just verifying that the final state is connected.
|
msg10547 (view) |
Author: Darjus Loktevic (darjus) |
Date: 2015-12-21.05:30:02 |
|
Yeah, that was intermittent. I've increased the number of loops and now it does the right thing
|
|
Date |
User |
Action |
Args |
2015-12-21 18:08:51 | zyasoft | set | status: pending -> closed |
2015-12-21 05:30:03 | darjus | set | messages:
+ msg10547 |
2015-12-11 02:42:16 | zyasoft | set | messages:
+ msg10531 |
2015-12-08 01:25:44 | darjus | set | nosy:
+ darjus messages:
+ msg10516 |
2015-11-23 22:50:19 | zyasoft | set | status: open -> pending resolution: fixed messages:
+ msg10505 |
2015-11-23 22:41:13 | zyasoft | set | messages:
+ msg10504 |
2015-11-23 21:26:13 | zyasoft | set | messages:
+ msg10501 |
2015-11-23 20:32:53 | zyasoft | create | |
|