|Re: [jetty-users] Failing to connect with v9.2.2 HttpClient|
On 08/15/2014 04:00 PM, Simone Bordet wrote:
Hi, On Fri, Aug 15, 2014 at 9:46 PM, Thomas Hurd<thurd@xxxxxxxxxx> wrote:I am having issues using Jetty HttpClient after upgrading from v9.0.4 to v9.2.2. I using RHEL 5.10 on a Dell Server. uname -r outputs: 2.6.18-371.8.1.el5 The machine does not have support for IPv6. I am using Oracle Java 7u60 JRE. When using v9.2.2 Jetty JARs, I did not see any connection attempt made to the destination. Running tcpdump confirmed this. After running strace on my test program, I found that the socket syscall is failing with 9.2.2 with PF_INET6 and not retrying with PF_INET. With v9.0.4, it retries with PF_INET and is successful. strace -f output using v9.0.4: socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = -1 EAFNOSUPPORT (Address family not supported by protocol) #then later... socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 8 #Afterwards the connect syscall was successful, and request/response was successful strace -f output using v9.2.2: socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = -1 EAFNOSUPPORT (Address family not supported by protocol) # no attempt at socket(PF_INET, ...) Additionally, I tried running the program with -Djava.net.preferIPv4Stack=true, but with the v9.2.2 JARs it still attempted to create the socket with PF_INET6. I am able to run a Jetty Servlet with v9.2.2 on the same machine without any issues. I also tried v9.1.5, and had the same results as with v9.2.2 Any help would be appreciated.Code looks good (minor nit you could use the fluent style to configure the request). The Jetty code to connect has not changed between 9.0.4 and 9.2.2, it has just been refactored into a different class, but it's exactly the same code. Frankly, it's really weird. Are you sure you're not using a non OpenJDK/Oracle JDK in one of the two cases ? Often old machines come with preinstalled java from who knows where, and it's enough to type "java" rather than "./java" (or something like that - different user different bash settings, etc.) to screw up everything.
Thanks for the quick reply.The Java 7u60 JDK is the only instance of Java I have installed on the system.
Both tests were created exactly the same except I pointed to v9.0.4 or v9.2.2 client/http/io/util JARs as referenced libraries before exporting to a runnable JAR in eclipse.
I ran the tests the same way: strace -f -o jetty-test-9.0.4 java -jar jetty-test-9.0.4.jar strace -f -o jetty-test-9.2.2 java -jar jetty-test-9.2.2.jar
Back to the top