You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "telemenar (via GitHub)" <gi...@apache.org> on 2025/05/05 18:28:45 UTC

Re: [I] Too many open files on Mac OS with JDK 11 and mvnd 0.8.2 [maven-mvnd]

telemenar commented on issue #710:
URL: https://github.com/apache/maven-mvnd/issues/710#issuecomment-2851954996

   I did a lot more digging recently. This is in fact a limitation to using GraalVM with the client. 
   
   The reason this happens is that the default behavior for the jvm (both GraalVM and others) is to, where possible, set the soft limit for number of open files to the hard limit for the number of open files. That limit is then inherited for child processes. 
   
   The reason this shows up on Mac OS as a problem is that, both GraalVM and OpenJDK, don't /actually/ do this on Mac OS. On MacOS as a result of a note in the`COMPATIBILITY` section of this man page:
   https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setrlimit.2.html
   They instead set the limit to `OPEN_MAX` from `syslimits.h` which has the static value `10240`
   
   This is done here in GraalVM:
   https://github.com/oracle/graal/blob/vm-21.3.12/substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/PosixNativeLibraryFeature.java#L87
   
   And here in OpenJDK:
   https://github.com/openjdk/jdk/blob/jdk-21%2B35/src/hotspot/os/bsd/os_bsd.cpp#L2005
   
   However in OpenJDK you can skip this with the `-XX:-MaxFDLimit` setting which would cause this to be skipped based on this line for OpenJDK:
   https://github.com/openjdk/jdk/blob/jdk-21%2B35/src/hotspot/os/bsd/os_bsd.cpp#L1991
   
   But on GraalVM the max files limit is always set to 10240 on MacOS. That is then inherited by the child process whether or not the server uses GraalVM. The only way to work around this would be to start daemons from something that isn't initializing GraalVM. I don't really see anything that mvnd can do about this. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org