Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 02 Sep 2014 08:21:31 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-net@FreeBSD.org
Subject:   [Bug 193246] Bug in multicast bind(), uncovered by Jenkins
Message-ID:  <bug-193246-2472-58YauCWPgE@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-193246-2472@https.bugs.freebsd.org/bugzilla/>
References:  <bug-193246-2472@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193246

--- Comment #1 from Craig Rodrigues <rodrigc@FreeBSD.org> ---
Previously, I reported some error messages reported by Jenkins
on startup:

http://lists.freebsd.org/pipermail/freebsd-java/2014-February/010593.html

I looked at the Jenkins source code, and isolated the problem.
I wrote this simple testcase (see attached MulticastTest.java),
which I am also including inline:

================================================================================
/*
 * To build this test,
 * (1) Make sure that the OpenJDK is installed from ports:
 *
 *       pkg install openjdk
 *
 * (2) Rename this file to: MulticastTest.java
 * (3) Build it:
 *     
 *        javac MulticastTest.java
 *
 *  (4) Run it:
 *
 *        java MulticastTest.java
 *
 */

import java.net.InetAddress;
import java.net.MulticastSocket;

class MulticastTest
{

    public static void main(String[] args)
    {
       try {
        int PORT = Integer.getInteger("hudson.udp",33848);

        InetAddress MULTICAST = InetAddress.getByAddress(new byte[]{(byte)239,
(byte)77, (byte)124, (byte)213});
        MulticastSocket mcs = new MulticastSocket(PORT);
        mcs.joinGroup(MULTICAST);
       } catch (Exception e) {
          e.printStackTrace();
          System.exit(-1);  
       }
    }
}
================================================================================

If I run this testcase, I get the same error as what I reported earlier
with Jenkins:

java.net.SocketException: Invalid argument
        at java.net.PlainDatagramSocketImpl.join(Native Method)
        at
java.net.AbstractPlainDatagramSocketImpl.join(AbstractPlainDatagramSocketImpl.java:178)
        at java.net.MulticastSocket.joinGroup(MulticastSocket.java:319)
        at MulticastTest.main(MulticastTest.java:31)


If I run:

ktrace java MulticastTest

I see that the error here:

 13253 java     CALL  setsockopt(0x4,0x29,0x1b,0x7fffffbfd7dc,0x4)
 13253 java     RET   setsockopt 0
 13253 java     CALL 
setsockopt(0x4,SOL_SOCKET,SO_BROADCAST,0x7fffffbfd7d8,0x4)
 13253 java     RET   setsockopt 0
 13253 java     CALL 
getsockopt(0x4,SOL_SOCKET,SO_TYPE,0x7fffffbfd77c,0x7fffffbfd778)
 13253 java     RET   getsockopt 0
 13253 java     CALL 
setsockopt(0x4,SOL_SOCKET,SO_REUSEPORT,0x7fffffbfd7e0,0x4)
 13253 java     RET   setsockopt 0
 13253 java     CALL 
setsockopt(0x4,SOL_SOCKET,SO_REUSEADDR,0x7fffffbfd7e0,0x4)
 13253 java     RET   setsockopt 0
 13253 java     CALL  bind(0x4,0x7fffffbfd7a8,0x1c)
 13253 java     STRU  struct sockaddr { AF_INET6, [::]:33848 }
 13253 java     RET   bind 0
 13253 java     CALL  setsockopt(0x4,0x29,0x9,0x7fffffbfd7f4,0x4)
 13253 java     RET   setsockopt 0
 13253 java     CALL  getsockopt(0x4,0x29,0x9,0x7fffffbfd8ac,0x7fffffbfd864)
 13253 java     RET   getsockopt 0
 13253 java     CALL  setsockopt(0x4,0x29,0xc,0x7fffffbfd8c0,0x14)
 13253 java     RET   setsockopt -1 errno 22 Invalid argument


This looks like a bug in the FreeBSD networking code for multicast,
or a bug in the FreeBSD code in the OpenJDK.

This Java code works under Linux, Solaris, Windows, etc., so it
would be good to fix this problem on FreeBSD.

Can a networking person help me with this?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-193246-2472-58YauCWPgE>