Skip to content

Audit and test OSProcess open file limit implementations #3286

Closed

Description

@dbwiddis

Problem

While reviewing PR #3285, diff coverage highlighted that the Linux FFM implementations of LinuxOSProcessFFM.queryRlimitSoft() and LinuxOSProcessFFM.queryRlimitHard() are effectively uncovered. The missing coverage is not introduced by that PR; it exposed an existing testing gap around the OSProcess open file limit API.

The same macOS gap was identified in #3287.

Issue #2215 was completed by PR #2225 and did add process-specific open file descriptor limit APIs across multiple platforms. However, the current test coverage appears to be mostly API-level smoke coverage, and does not give much confidence that the per-platform implementations, or the JNA/FFM equivalents, return consistent and correct values.

Findings

  • OSProcess exposes getSoftOpenFileLimit() and getHardOpenFileLimit().
  • Implementations exist across Linux, macOS, AIX, FreeBSD, OpenBSD, Solaris, and Windows.
  • Linux now has backend-specific hooks (queryRlimitSoft() / queryRlimitHard()) for native-free, JNA, and FFM implementations.
  • Existing shared tests only assert broad nonnegative/-1 behavior for the current process, and do not meaningfully compare JNA vs. FFM results.
  • While auditing, MacOSProcessFFM stood out as suspicious: it checks getrlimit(...) > 0, but POSIX getrlimit() succeeds with return value 0. That should be verified and fixed if confirmed.

Suggested work

  • Add or improve smoke tests for OSProcess.getSoftOpenFileLimit() and getHardOpenFileLimit().
  • Add FFM-vs-JNA comparison coverage where the test infrastructure supports it.
  • Audit each platform implementation for correctness, especially success/error handling around native getrlimit() calls.
  • Confirm whether the macOS FFM getrlimit() success check should be == 0 rather than > 0.

Related

Activity

  1. added
    bug?
    PR welcome
    java
    good first issue
    up for grabs
    confirmed bug
    and removed
    java
    bug?
    good first issue
    up for grabs
    PR welcome
    on May 23, 2026
  2. self-assigned this
    on May 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

confirmed bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions