From owner-freebsd-java@FreeBSD.ORG Tue Sep 2 08:21:32 2014 Return-Path: Delivered-To: freebsd-java@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DC6AAE78 for ; Tue, 2 Sep 2014 08:21:31 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C35C41AB4 for ; Tue, 2 Sep 2014 08:21:31 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id s828LVec055090 for ; Tue, 2 Sep 2014 08:21:31 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-java@FreeBSD.org Subject: [Bug 193246] Bug in multicast bind(), uncovered by Jenkins Date: Tue, 02 Sep 2014 08:21:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 10.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: rodrigc@FreeBSD.org X-Bugzilla-Status: Needs Triage X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-net@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Sep 2014 08:21:32 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193246 --- Comment #1 from Craig Rodrigues --- 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.