[GRADLE-930] SocketException when running buildSrc tests Created: 05/May/10  Updated: 04/Jan/13  Resolved: 24/Nov/10

Status: Resolved
Project: Gradle
Affects Version/s: 0.9
Fix Version/s: 0.9-rc-1

Type: Bug
Reporter: Marcus Better Assignee: Adam Murdoch
Resolution: Fixed Votes: 0


 Description   

My tests in buildSrc, using Groovy and TestNG, always fail to run with this exception:

:buildSrc:testorg.gradle.api.GradleException: java.net.SocketException: Network is unreachable
        at org.gradle.messaging.dispatch.TcpOutgoingConnector.connect(TcpOutgoingConnector.java:45)
        at org.gradle.messaging.dispatch.DefaultMultiChannelConnector.connect(DefaultMultiChannelConnector.java:82)
        at org.gradle.messaging.DefaultMessagingClient.<init>(DefaultMessagingClient.java:28)
        at org.gradle.messaging.TcpMessagingClient.<init>(TcpMessagingClient.java:32)
        at org.gradle.process.child.ActionExecutionWorker.createClient(ActionExecutionWorker.java:85)
        at org.gradle.process.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:49)
        at org.gradle.process.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:34)
        at org.gradle.process.child.ImplementationClassLoaderWorker.execute(ImplementationClassLoaderWorker.java:75)
        at org.gradle.process.child.ImplementationClassLoaderWorker.execute(ImplementationClassLoaderWorker.java:32)
        at org.gradle.process.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:45)
        at org.gradle.process.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:29)
        at org.gradle.process.launcher.BootstrapClassLoaderWorker.call(BootstrapClassLoaderWorker.java:63)
        at org.gradle.process.launcher.BootstrapClassLoaderWorker.call(BootstrapClassLoaderWorker.java:46)
        at org.gradle.process.launcher.GradleWorkerMain.run(GradleWorkerMain.java:30)
        at org.gradle.process.launcher.GradleWorkerMain.main(GradleWorkerMain.java:35)
Caused by: java.net.SocketException: Network is unreachable
        at sun.nio.ch.Net.connect(Native Method)
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:525)
        at java.nio.channels.SocketChannel.open(SocketChannel.java:164)
        at org.gradle.messaging.dispatch.TcpOutgoingConnector.connect(TcpOutgoingConnector.java:40)
        ... 14 more
Could not send message, as connection is stopping.
Could not send message, as connection is stopping.
Could not send message, as connection is stopping.
Could not send message, as connection is stopping.
Could not send message, as connection is stopping.
Could not send message, as connection is stopping.

The buildSrc/build.gradle is simple:

apply plugin: 'groovy'

repositories {
    mavenCentral()
}

dependencies {
    groovy group: 'org.codehaus.groovy', name: 'groovy-all', version: '1.7.2'
    testCompile group: 'net.sourceforge.nekohtml', name: 'nekohtml', version: '1.9.12'
    testCompile group: 'xerces', name: 'xercesImpl', version: '2.8.1'
    testCompile group: 'org.testng', name: 'testng', version: '5.12.1'
}

test {
    useTestNG()    
}

There are two test classes in buildSrc/src/test/groovy. They compile correctly but do not seem to run (I think) before the failure.



 Comments   
Comment by Adam Murdoch [ 05/May/10 ]

I can't reproduce this. I assume it's something to do with your network configuration. For some reason, the test process cannot connect to the loopback address on your machine. Possibly a firewall issue? I've added some trace to head, to see if we can determine why. Could you try this out with gradle -d?

Comment by Marcus Better [ 06/May/10 ]

I should have thought of this earlier, it has to do with the mess with IPv6-mapped IPv4 addresses:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560056
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6342561

Setting "sysctl net.ipv6.bindv6only=0" fixes it.

Not sure what Gradle is trying to do here, but it looks like it is listening on an IPv6 address (::1) and then trying to connect over IPv4. That will no longer work on Debian squeeze with default settings, and not on some other Unixes either.

Comment by Adam Murdoch [ 06/May/10 ]

Thanks for that. I can reproduce it now, with net.ipv6.bindv6only=1

I've pushed a fix to head. Could you try it out (with the default value for net.ipv6.bindv6only)?

Generated at Wed Jun 30 11:42:34 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.