elastic/elasticsearch · warning · UnsupportedOperationException
RLIMIT_NPROC unavailable: {}
Error message
RLIMIT_NPROC unavailable: {} What it means
Thrown during macOS BSD sandbox setup in tryInstallExecSandbox() → initBsdSandbox(). As a secondary hardening measure (beyond seatbelt), the code calls setrlimit(RLIMIT_NPROC=7, {0, 0}) to prevent the process from forking new processes. If setrlimit returns non-zero, this error fires with strerror. RLIMIT_NPROC=7 is macOS/BSD-specific (it means something different on Linux, hence the hardcoded constant).
Source
Thrown at libs/native/src/main/java/org/elasticsearch/nativeaccess/MacNativeAccess.java:154
MemorySegment errorPtr = errorBuf.get(ValueLayout.ADDRESS, 0);
String message = MemorySegmentAdapter.getString(errorPtr.reinterpret(Long.MAX_VALUE), 0);
macLibc.sandbox_free_error(errorPtr);
throw new UnsupportedOperationException("sandbox_init(): " + message);
}
logger.debug("OS X seatbelt initialization successful");
} finally {
IOUtils.deleteFilesIgnoringExceptions(rules);
}
}
private void initBsdSandbox() {
RLimit limit = libc.newRLimit();
limit.rlim_cur(0);
limit.rlim_max(0);
// not a standard limit, means something different on linux, etc!
final int RLIMIT_NPROC = 7;
if (libc.setrlimit(RLIMIT_NPROC, limit) != 0) {
throw new UnsupportedOperationException("RLIMIT_NPROC unavailable: " + libc.strerror(libc.errno()));
}
logger.debug("BSD RLIMIT_NPROC initialization successful");
}
}
View on GitHub (pinned to db6a809a66)
Solutions
- Read the strerror in the message to identify the errno (commonly EPERM).
- Ensure the ES process runs with sufficient privileges to call setrlimit.
- Verify no child processes or excessive threads exist at the time of the call.
- If the RLIMIT_NPROC hardening is not required, accept the failure — the seatbelt sandbox (error 669 path) is the primary defense.
Defensive patterns
Strategy: try-catch
Try / catch
try {
nativeAccess.tryInstallExecSandbox();
} catch (UnsupportedOperationException e) {
// setrlimit(RLIMIT_NPROC, 0) failed.
logger.warn("BSD RLIMIT_NPROC sandbox unavailable: {}", e.getMessage());
} Prevention
- Ensure the ES process runs with privileges sufficient to call setrlimit.
- Verify no existing resource-limit policy prevents lowering RLIMIT_NPROC.
- Note that RLIMIT_NPROC is a secondary hardening measure — the seatbelt sandbox (initMacSandbox) is the primary defense.
When it happens
Trigger: Calling tryInstallExecSandbox() on macOS where libc.setrlimit(RLIMIT_NPROC, limit) returns non-zero after setting both rlim_cur and rlim_max to 0. The limit struct was allocated via libc.newRLimit().
Common situations: Insufficient privileges to set resource limits; the process has already spawned child processes or threads that conflict with RLIMIT_NPROC=0; macOS versions where RLIMIT_NPROC semantics differ; running under an existing resource-limit policy that prevents lowering NPROC.
Related errors
- sandbox_init(): {}
- seccomp unavailable: '{}' architecture unsupported
- seccomp unavailable: seccomp(BOGUS_OPERATION) returned {}
- seccomp(BOGUS_OPERATION): {}
- seccomp unavailable: seccomp(SECCOMP_SET_MODE_FILTER, BOGUS_
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/3c8d628c905dfccb.
Report an issue: GitHub.