MessagingServicesTest cannot join mcast group on FreeBSD: Invalid argument


13:12:33.586 [DEBUG] [TestEventLogger]         Caused by:
13:12:33.587 [DEBUG] [TestEventLogger]         java.lang.RuntimeException: Could not create multicast socket for /
13:12:33.587 [DEBUG] [TestEventLogger]             at org.gradle.messaging.remote.internal.inet.MulticastConnection.<init>(
13:12:33.587 [DEBUG] [TestEventLogger]             at org.gradle.messaging.remote.internal.MessagingServices.createMulticastConnection(
13:12:33.587 [DEBUG] [TestEventLogger]             at org.gradle.internal.reflect.JavaMethod.invoke(
13:12:33.587 [DEBUG] [TestEventLogger]             at org.gradle.internal.service.DefaultServiceRegistry.invoke(
13:12:33.588 [DEBUG] [TestEventLogger]             at org.gradle.internal.service.DefaultServiceRegistry.access$1200(
13:12:33.588 [DEBUG] [TestEventLogger]             at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(
13:12:33.588 [DEBUG] [TestEventLogger]             ... 10 more
13:12:33.588 [DEBUG] [TestEventLogger]
13:12:33.588 [DEBUG] [TestEventLogger]             Caused by:
13:12:33.588 [DEBUG] [TestEventLogger]    Invalid argument
13:12:33.588 [DEBUG] [TestEventLogger]                 at
13:12:33.588 [DEBUG] [TestEventLogger]                 at
13:12:33.589 [DEBUG] [TestEventLogger]                 at org.gradle.messaging.remote.internal.inet.MulticastConnection.<init>(
13:12:33.589 [DEBUG] [TestEventLogger]                 ... 15 more
13:12:33.593 [DEBUG] [TestEventLogger]
13:12:33.593 [DEBUG] [TestEventLogger] org.gradle.messaging.remote.internal.MessagingServicesTest FAILED

I get this also with this Jython script, so it’s not a Grade-only issue:

>>> from import * 
>>> z = InetAddress.getAllByName("")
>>> q = MulticastSocket(7912)                     
>>> q
>>> z     
array(, [/])
>>> q.joinGroup(z[0])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
        at Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke( Invalid argument
>>> q.getNetworkInterface()
name:re0 (re0)

This is FreeBSD bug #193246: Bug in IPv6 multicast join(), uncovered by Jenkins
and can be worked around by adding to Java VM arguments.

…but I have some trouble adding… tried JAVA_OPTS, GRADLE_OPTS, as well as ./gradlew and listing in $HOME/.gradle/ - nothing seems to work. Also when the daemon gets started it has those options not set (I tested with -no-daemon of course).