Why does it take so long for Eclipse to connect to a JUnitRunner process when IPv6 is enabled?

0

1

When IPv6 is enabled on my computer, half a minute passed between starting a new JUnit process and the test tree appearing in the JUnit view.

When I disable IPv6, the tests appear immediately.

What I see is that the process is created and then hangs ca. 30s in SocketImpl.connect(). With netstat, I can see a line like this:

tcp6       0      1 fe80::xxxx:xxxx:x:51019 ::1:48469               SYN_SENT

Why does that happen?

Aaron Digulla

Posted 2012-05-10T07:29:07.093

Reputation: 6 035

Answers

1

One possibility:

The runner process is listening only on 127.0.0.1, the IPv4 loopback address, but Eclipse is trying to connect to localhost – which can be either 127.0.0.1 or ::1, the latter being IPv6 loopback. On most operating systems, IPv6 is enabled, it will be preferred, causing Eclipse to try IPv6 ::1 first.

Since JUnitRunner is not listening on any IPv6 address, the OS should reject attempted connections with a TCP RST (or mayyybe ICMP "Port Unreachable" if properly firewalled). However, you probably have a firewall configuration that is silently dropping such attempts, which means the client (Eclipse) will be waiting for a reply that is never sent.

First check your firewall configuration (ip6tables) – there is no reason for it to block loopback connections in any way. Test with the firewall temporarily disabled. If nothing helps, check if Eclipse can be configured to use 127.0.0.1, or if JUnit can be configured to listen on both IPv6 and IPv4.

user1686

Posted 2012-05-10T07:29:07.093

Reputation: 283 655

:-/ The netstat line above says Eclipse isn't trying to use loopback at all. – Aaron Digulla – 2012-05-10T12:27:11.090

@AaronDigulla: But ::1 is IPv6 loopback. – user1686 – 2012-05-10T12:31:47.440

Ah! I completely missed the right side. Why isn't it showing "::1:51019 ::1:48469"? – Aaron Digulla – 2012-05-10T12:33:08.990

I checked with ip6tables: There are no rules and all three chains have the policy "ACCEPT" – Aaron Digulla – 2012-05-10T12:34:26.277

Hmm, I don't know why it is showing a fe80: address. Does ping6 ::1 reach loopback correctly? – user1686 – 2012-05-10T12:45:08.390

Yes, ping6 ::1 works. – Aaron Digulla – 2012-05-10T16:03:00.063