Issue1711
Created on 2011-02-25.20:24:06 by xjyvb3, last changed 2011-02-28.22:38:01 by amak.
Files | ||||
---|---|---|---|---|
File name | Uploaded | Description | Edit | Remove |
unnamed | xjyvb3, 2011-02-28.14:58:20 | |||
unnamed | xjyvb3, 2011-02-28.19:37:24 | |||
unnamed | xjyvb3, 2011-02-28.21:08:19 | |||
unnamed | xjyvb3, 2011-02-28.22:10:21 |
Messages | |||
---|---|---|---|
msg6405 (view) | Author: Peter (xjyvb3) | Date: 2011-02-25.20:24:05 | |
This is probably some basic user error on my part. I understood that IPv6 was suspect due to prior JRE implementations, but I thought I would try it with the latest available versions. This is a small portion of client server code, only the client side needed to show the issue. Generally, this code works under plain python 2.7.1 I'm guessing that maybe this may be a failure just under my OS/JRE combo. D:\jy252rc4>jython Jython 2.5.2rc4 (Release_2_5_2rc4:7200, Feb 14 2011, 23:43:30) [Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_24 Type "help", "copyright", "credits" or "license" for more information. >>> import socket >>> socket._use_ipv4_addresses_only(False) >>> HOST,PORT="::1",9999 >>> sock=socket.socket(socket.AF_INET6, socket.SOCK_STREAM) >>> sock.connect((HOST,PORT)) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 1, in connect File "D:\jy252rc4\Lib\socket.py", line 975, in connect self._do_connect(addr) File "D:\jy252rc4\Lib\socket.py", line 971, in _do_connect raise _map_exception(jlx) socket.error: (10047, 'Address family not supported by protocol family: See http ://wiki.python.org/jython/NewSocketModule#IPV6addresssupport') >>> Using Windows 7, Jython 2.5.2rc4, Java 1.6.0_24: |
|||
msg6406 (view) | Author: Alan Kennedy (amak) | Date: 2011-02-26.20:21:54 | |
The problem here is obviously the use of an IPV6 address. Note that the use of _use_ipv4_addresses_only(False) has no effect in this situation: that call only affects results returned from the getaddrinfo() function. It apppears, from my research, that this problem still persists on Windows 7 64 Bit, especially if it has been upgraded from Windows Vista rather than cleanly installed. See the following links http://programming.manessinger.com/2010/03/30/4-equipment/ http://netbeans-org.1045718.n5.nabble.com/Error-while-starting-glassfish-v3-in-netbeans-6-8-java-net-BindException-Address-family-not-supporte2-td2891871.html In order to be certain that this is a Java problem (and thus something that cannot be solved within jython), I will post some code snippets in following messages. |
|||
msg6407 (view) | Author: Alan Kennedy (amak) | Date: 2011-02-26.20:35:10 | |
First off, as mentioned in a previous message, the _use_ipv4_addresses_only(False) only affects return values from the getaddrinfo() function. Therefore, if you want to use IPV6 addresses, the best code would look like this. >>> import socket >>> socket._use_ipv4_addresses_only(False) # Not necessary, this is the default >>> address = socket.getaddrinfo("localhost", 9999, socket.AF_INET6)[0][4] >>> address ('0:0:0:0:0:0:0:1', 9999, 0, 0) >>> sock=socket.socket(socket.AF_INET6, socket.SOCK_STREAM) >>> sock.connect(address) The address actually being used in your code sample, i.e. what is used internally by the conect() call, can be illustrated as follows >>> import socket >>> address = socket._get_jsockaddr( ("::1", 9999) ) >>> type(address) <type 'java.net.InetSocketAddress'> >>> address /0:0:0:0:0:0:0:1:9999 >>> sock=socket.socket(socket.AF_INET6, socket.SOCK_STREAM) >>> sock.connect(address) |
|||
msg6408 (view) | Author: Alan Kennedy (amak) | Date: 2011-02-26.20:41:48 | |
To determine if this is problem with the underlying ipv6 support in your JVM, please can you compile and run the following code with your JDK on your platform, and report the results. //===================================== import java.net.InetSocketAddress; import java.nio.channels.SocketChannel; class ipv6 { static public void main(String[] notUsed) throws Exception { InetSocketAddress ipv6_addr = new InetSocketAddress("::1", 9999); SocketChannel channel = SocketChannel.open(); channel.socket().connect(ipv6_addr); } } // end |
|||
msg6409 (view) | Author: Alan Kennedy (amak) | Date: 2011-02-26.20:49:31 | |
Here is the same code in jython, but using the Java APIs directly, with no involvement from the jython socket module. >>> import java >>> ipv6_addr = java.net.InetSocketAddress("::1", 9999) >>> s = java.nio.channels.SocketChannel.open() >>> s.socket().connect(ipv6_addr) Which I think will result in something like this on your system Traceback (most recent call last): File "<stdin>", line 1, in <module> at sun.nio.ch.Net.connect(Native Method) at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:464) at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:81) at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) java.net.SocketException: java.net.SocketException: Address family not supported by protocol family: connect |
|||
msg6412 (view) | Author: Peter (xjyvb3) | Date: 2011-02-28.14:58:21 | |
Hello, Yes, that is pretty much the error I get. I don't even have the latest 1.6 JDK, just the JRE, so the ' import java' route was useful. Jython 2.5.2rc4 (Release_2_5_2rc4:7200, Feb 14 2011, 23:43:30) [Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_24 Type "help", "copyright", "credits" or "license" for more information. >>> import java >>> ipv6_addr=java.net.InetSocketAddress("::1",9999) >>> s=java.nio.channels.SocketChannel.open() >>> s.socket().connect(ipv6_addr) Traceback (most recent call last): File "<stdin>", line 1, in <module> at sun.nio.ch.Net.connect(Native Method) at sun.nio.ch.SocketChannelImpl.connect(Unknown Source) at sun.nio.ch.SocketAdaptor.connect(Unknown Source) at sun.nio.ch.SocketAdaptor.connect(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) java.net.SocketException: java.net.SocketException: Address family not supported by protocol family: connect I conclude that JRE6 64bit has some IPv6 problems still. Do you think I should try to report that to Oracle/Sun/Java folks? The Windows 7 install should be pretty clean, I did it from a MS disk since I am basically the IT department :-). I guess I could also try this with the 32 bit JRE and see if it works (not sure the 32 bit JRE will even run under 64 bit Windows). Thanks for the fast feedback and diagnosis, Peter On Sat, Feb 26, 2011 at 2:49 PM, Alan Kennedy <report@bugs.jython.org>wrote: > > Alan Kennedy <jython-dev@xhaus.com> added the comment: > > Here is the same code in jython, but using the Java APIs directly, with no > involvement from the jython socket module. > > >>> import java > >>> ipv6_addr = java.net.InetSocketAddress("::1", 9999) > >>> s = java.nio.channels.SocketChannel.open() > >>> s.socket().connect(ipv6_addr) > > Which I think will result in something like this on your system > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > at sun.nio.ch.Net.connect(Native Method) > at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:464) > at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:81) > at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:65) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:592) > > java.net.SocketException: java.net.SocketException: Address family not > supported by protocol family: > connect > > _______________________________________ > Jython tracker <report@bugs.jython.org> > <http://bugs.jython.org/issue1711> > _______________________________________ > |
|||
msg6413 (view) | Author: Peter (xjyvb3) | Date: 2011-02-28.19:37:24 | |
Hello, Some further information: - Today, I downloaded Windows 7 SP1 released 2/22/11, this made no difference to the problem. - I have applied the changes suggested in...Error-while-starting-glassfish-v3-in-netbeans-6-8-java-net-BindException-Address-family-not-supporte2-td2891871.html<http://netbeans-org.1045718.n5.nabble.com/Error-while-starting-glassfish-v3-in-netbeans-6-8-java-net-BindException-Address-family-not-supporte2-td2891871.html>and this made no difference. - I also downloaded the 32 bit JRE and tried every permutation of hosts (no entry, '::1 localhost', or '127.0.0.1 localhost' with both 32 and 64 bit 1.6 JRE, to no effect Thanks again for the thought and diagnosis. If you know of a good Java forum to relate this problem to I will happily report it there, since this seems like it's a Java issue and not a Jython issue. Peter On Mon, Feb 28, 2011 at 8:58 AM, P ete <xj7vb3@gmail.com> wrote: > Hello, > > Yes, that is pretty much the error I get. I don't even have the latest > 1.6 JDK, just the JRE, so the ' import java' route was useful. > > > Jython 2.5.2rc4 (Release_2_5_2rc4:7200, Feb 14 2011, 23:43:30) > [Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_24 > Type "help", "copyright", "credits" or "license" for more information. > >>> import java > >>> ipv6_addr=java.net.InetSocketAddress("::1",9999) > >>> s=java.nio.channels.SocketChannel.open() > >>> s.socket().connect(ipv6_addr) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > at sun.nio.ch.Net.connect(Native Method) > at sun.nio.ch.SocketChannelImpl.connect(Unknown Source) > at sun.nio.ch.SocketAdaptor.connect(Unknown Source) > at sun.nio.ch.SocketAdaptor.connect(Unknown Source) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > > > java.net.SocketException: java.net.SocketException: Address family not > supported > by protocol family: connect > > > I conclude that JRE6 64bit has some IPv6 problems still. Do you think I > should try to report that to Oracle/Sun/Java folks? > > The Windows 7 install should be pretty clean, I did it from a MS disk since > I am basically the IT department :-). I guess I could also try this with > the 32 bit JRE and see if it works (not sure the 32 bit JRE will even run > under 64 bit Windows). > > Thanks for the fast feedback and diagnosis, > > Peter > > > On Sat, Feb 26, 2011 at 2:49 PM, Alan Kennedy <report@bugs.jython.org>wrote: > >> >> Alan Kennedy <jython-dev@xhaus.com> added the comment: >> >> Here is the same code in jython, but using the Java APIs directly, with no >> involvement from the jython socket module. >> >> >>> import java >> >>> ipv6_addr = java.net.InetSocketAddress("::1", 9999) >> >>> s = java.nio.channels.SocketChannel.open() >> >>> s.socket().connect(ipv6_addr) >> >> Which I think will result in something like this on your system >> >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> at sun.nio.ch.Net.connect(Native Method) >> at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:464) >> at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:81) >> at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:65) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> at java.lang.reflect.Method.invoke(Method.java:592) >> >> java.net.SocketException: java.net.SocketException: Address family not >> supported by protocol family: >> connect >> >> _______________________________________ >> Jython tracker <report@bugs.jython.org> >> <http://bugs.jython.org/issue1711> >> _______________________________________ >> > > |
|||
msg6415 (view) | Author: Alan Kennedy (amak) | Date: 2011-02-28.21:05:19 | |
> I conclude that JRE6 64bit has some IPv6 problems still. Do you > think I should try to report that to Oracle/Sun/Java folks? OK, pity that I was right on this: I was really expecting better of the latest Java on the latest Windows. I see that this problem is a common one http://www.google.com/#q=windows+7+64+bit+java+%22address+family+not+supported%22 As for whether you should report it, I don't think it would do any harm to report it to Oracle AND Microsoft. But I would not be hopeful of a quick response. I will talk about workarounds in future messages. |
|||
msg6416 (view) | Author: Peter (xjyvb3) | Date: 2011-02-28.21:08:19 | |
I'm delighted to report that I can get this to work using the JRE 1.7, 64 bit, that is in early trials with Windows 7 with SP1. You must have the server there to answer, naturally! That part is running in Python but I will now work on making that Jython. Thanks for the help, it got me on the right path fast. Peter |
|||
msg6417 (view) | Author: Alan Kennedy (amak) | Date: 2011-02-28.21:54:11 | |
> I'm delighted to report that I can get this to work using the JRE 1.7, 64 > bit, that is in early trials with Windows 7 with SP1. Yay! Glad it worked out. I have updated the wiki with this information: thank you for advancing the jython knowledge base. > You must have the server there to answer, naturally! That part is running > in Python but I will now work on making that Jython. No, I just know well how my code behaves ;-) > Thanks for the help, it got me on the right path fast. Glad to be of service. So, if you don't mind I'll be closing this bug. I'll leave it open for another day, just in case. |
|||
msg6418 (view) | Author: Alan Kennedy (amak) | Date: 2011-02-28.21:54:59 | |
Here's a link to the relevant section on the wiki. http://wiki.python.org/jython/NewSocketModule#IPV6_address_support |
|||
msg6419 (view) | Author: Peter (xjyvb3) | Date: 2011-02-28.22:10:21 | |
I was going to ask how to close it, so yes, definitely, please do close. On Mon, Feb 28, 2011 at 3:54 PM, Alan Kennedy <report@bugs.jython.org>wrote: > > Alan Kennedy <jython-dev@xhaus.com> added the comment: > > > I'm delighted to report that I can get this to work using the JRE 1.7, 64 > > bit, that is in early trials with Windows 7 with SP1. > > Yay! Glad it worked out. > > I have updated the wiki with this information: thank you for advancing the > jython knowledge base. > > > You must have the server there to answer, naturally! That part is > running > > in Python but I will now work on making that Jython. > > No, I just know well how my code behaves ;-) > > > Thanks for the help, it got me on the right path fast. > > Glad to be of service. > > So, if you don't mind I'll be closing this bug. I'll leave it open for > another day, just in case. > > _______________________________________ > Jython tracker <report@bugs.jython.org> > <http://bugs.jython.org/issue1711> > _______________________________________ > |
|||
msg6421 (view) | Author: Alan Kennedy (amak) | Date: 2011-02-28.22:38:01 | |
Closing this bug, by agreement with the reporter. Changing the title to have more specific information abou java versions. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2011-02-28 22:38:01 | amak | set | status: open -> closed resolution: wont fix messages: + msg6421 title: IPv6 sock.connect gives 'Address family not supported by protocol family' -> IPv6 sock.connect gives 'Address family not supported by protocol family' on Java 6 but not Java 7. |
2011-02-28 22:10:21 | xjyvb3 | set | files:
+ unnamed messages: + msg6419 |
2011-02-28 21:54:59 | amak | set | messages: + msg6418 |
2011-02-28 21:54:12 | amak | set | messages: + msg6417 |
2011-02-28 21:08:19 | xjyvb3 | set | files:
+ unnamed messages: + msg6416 |
2011-02-28 21:05:19 | amak | set | messages: + msg6415 |
2011-02-28 19:37:24 | xjyvb3 | set | files:
+ unnamed messages: + msg6413 |
2011-02-28 14:58:21 | xjyvb3 | set | files:
+ unnamed messages: + msg6412 |
2011-02-26 20:49:32 | amak | set | messages: + msg6409 |
2011-02-26 20:41:48 | amak | set | messages: + msg6408 |
2011-02-26 20:35:10 | amak | set | messages: + msg6407 |
2011-02-26 20:21:55 | amak | set | messages: + msg6406 |
2011-02-25 23:43:42 | pjenvey | set | assignee: amak nosy: + amak |
2011-02-25 20:24:06 | xjyvb3 | create |
Supported by Python Software Foundation,
Powered by Roundup