JDK-8044365 : (dc) MulticastSendReceiveTests.java failing with ENOMEM when joining group (OS X 10.9)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2014-05-29
  • Updated: 2021-11-05
  • Resolved: 2020-03-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 14 JDK 7 JDK 8 Other
11.0.8-oracleFixed 14.0.2 b01Fixed 7u271Fixed 8u261Fixed openjdk8u322Fixed
Related Reports
Relates :  
Relates :  
Description
In hs-rt nightly testing

RULE java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java Exception java.net.SocketException: Cannot al... 

----------System.err:(18/1044)----------
java.net.SocketException: Cannot allocate memory
	at sun.nio.ch.Net.joinOrDrop4(Native Method)
	at sun.nio.ch.Net.join4(Net.java:517)
	at sun.nio.ch.DatagramChannelImpl.innerJoin(DatagramChannelImpl.java:871)
	at sun.nio.ch.DatagramChannelImpl.join(DatagramChannelImpl.java:900)
	at MulticastSendReceiveTests.test(MulticastSendReceiveTests.java:215)
	at MulticastSendReceiveTests.main(MulticastSendReceiveTests.java:238)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:484)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
	at java.lang.Thread.run(Thread.java:745)
Comments
Fix request (8u) Backport is requested for parity with 8u-oracle. Review approval: https://mail.openjdk.java.net/pipermail/jdk8u-dev/2021-October/014357.html
16-10-2021

Fix request (11u) -- will label after testing completed. I would like to downport this for parity with 11.0.8-oracle. Applies clean except for copyright. The original patch updates 2019 to 2020, 11u has 2018 in that place: @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it
14-04-2020

FWIW, I have observed the same when running the test behind a VPN client. Tests seem to run fine without the VPN though. So indeed, it seems special routing configuration may cause ENOMEM.
26-03-2020

[~clanger] You may find this is configuration related to routing. The working that we have in the JDK is solely for the intermittent case.
26-03-2020

We're getting this error reproducibly on a MacOS 10.14.4 test server, even with this workaround in place (14u build): java.net.SocketException: Cannot allocate memory at java.base/sun.nio.ch.Net.joinOrDrop4(Native Method) at java.base/sun.nio.ch.Net.join4(Net.java:611) at java.base/sun.nio.ch.DatagramChannelImpl.innerJoin(DatagramChannelImpl.java:1489) at java.base/sun.nio.ch.DatagramChannelImpl.join(DatagramChannelImpl.java:1517) at MulticastSendReceiveTests.test(MulticastSendReceiveTests.java:230) at MulticastSendReceiveTests.main(MulticastSendReceiveTests.java:268) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127) at java.base/java.lang.Thread.run(Thread.java:832) Will try to dig into the details tomorrow...
26-03-2020

URL: https://hg.openjdk.java.net/jdk-updates/jdk14u/rev/591e3b2374db User: igerasim Date: 2020-03-21 02:51:44 +0000
21-03-2020

As part of JDK-8236925, we put a workaround into to retry IP_ADD_MEMBERSHIP or IPV6_ADD_MEMBERSHIP on macOS when the setsockopt fails with ENOMEM. This works around the suspected macOS bug. We need to submit a bug/reproducer to Apple on this issue.
20-03-2020

Have seen this (or similar) issue on my local machine with JDK 11: bash-3.2$ java -version java version "11.0.1" 2018-10-16 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode) bash-3.2$ uname -a Darwin igerasim-mac 18.7.0 Darwin Kernel Version 18.7.0: Thu Jan 23 06:52:12 PST 2020; root:xnu-4903.278.25~1/RELEASE_X86_64 x86_64 Exception in thread "Thread-122" java.lang.RuntimeException: java.net.SocketException: Cannot allocate memory at Sanity$NioClients.lambda$main$0(Sanity.java:142) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.net.SocketException: Cannot allocate memory at java.base/sun.nio.ch.Net.joinOrDrop4(Native Method) at java.base/sun.nio.ch.Net.join4(Net.java:542) at java.base/sun.nio.ch.DatagramChannelImpl.innerJoin(DatagramChannelImpl.java:999) at java.base/sun.nio.ch.DatagramChannelImpl.join(DatagramChannelImpl.java:1017)
07-03-2020

Has there been any sightings of this in the last few years? I suspect we can close this issue.
25-09-2019

Is there any way to duplicate this on newer macOSX releases?
03-09-2018

This thread of discussion might give some indication as to the problem: "My guess for what is happening is that the address mapping goes into a loop, which is why it can't allocate more memory." [1] [1] http://serverfault.com/questions/609262/routing-tables-in-os-x-mavericks-causing-traceroute-sendto-cannot-allocate-m
19-12-2014

Reproduced on Mac OS 10.9.5.
09-12-2014

Should the Unix version of Net.c at least be modified to have handleSocketError() call JNU_ThrowOutOfMemoryError for the ENOMEM case?
02-12-2014

The ENOMEM is likely coming from setsockopt that is used to join the group. This is likely something in the networking configuration rather than a JDK issue. It will need access to the specific machine in order to diagnose it further.
30-05-2014