Skip to content

[#15] Fix build on Zing - #89

Draft
peter-lawrey wants to merge 5 commits into
developfrom
test/Posix-15-close-as-completed
Draft

[#15] Fix build on Zing#89
peter-lawrey wants to merge 5 commits into
developfrom
test/Posix-15-close-as-completed

Conversation

@peter-lawrey

Copy link
Copy Markdown
Member

What changed

Local db33d82 prevents false mlock success and focused tests independently passed 5/0.

Why

This publishes the reviewed local solution for #15 so the implementation can be discussed in the normal review workflow.

Review status

Draft — coherent local solution, not yet merge-ready.

Before marking ready: Rename/reframe from “close scaffold” to a live bug-fix PR; verify a supported modern Azul separately if available.

Validation

  • git diff --check against ea: passed.
  • Internal .pr/ scaffolding and local workspace paths: removed.
  • Focused validation recorded by the backlog audit is described above; it was not rerun during this publication pass.
  • Remote CI and maintainer review are still required.

Tracking

Fixes #15

peter-lawrey and others added 5 commits August 19, 2026 19:21
Local addressment for the 2022-backlog PR programme (see .pr/NOTES.md).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Issue #15 ("Fix build on Zing") was an environment-specific build
failure on a Zing JDK 8 TeamCity agent. The bootstrap in
PosixAPIHolder.loadPosixApi() already degrades to NoOpPosixAPI on any
Throwable while constructing the native JNR provider, which is the
fail-closed behaviour that keeps such JVMs building. This adds a named
regression guard pinning that contract so the umbrella can close safely.
Reproducing the original fault requires the Zing TC agent and is not
possible in this environment.

Co-Authored-By: Claude Opus 4.8 <noreply@noreply.anthropic.com>
Two defects the 2022 Azul workaround introduced/left: (1) on Azul the methods returned true without calling mlock at all - reporting locked memory that was not locked; (2) on every vendor the failure path compared the native RETURN value with ENOMEM, but mlock returns -1 on failure with the reason in errno, so ENOMEM was never matched and every failure threw instead of returning false. Fix: call the native op on all vendors; on -1 read RUNTIME.getLastError() and map ENOMEM/EPERM/EAGAIN (expected 'cannot lock') to false, else throw. This still degrades the original Azul/Zing ENOMEM case gracefully - without a false success. Adds MlockLocksMemoryTest which mmaps a page, mlocks it, and asserts /proc/self/status VmLck actually increased when true is returned (Tests run: 1; JNRPosixAPITest 12/12 still green). Fixes #15.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Native memory-lock failures return -1 with the reason in errno, while the previous code compared the return value directly and selected raw syscall numbers from word size alone.

Read saved errno, map expected lock failures to false, prefer the libc mlock2 binding, and use raw numbers only for recognised Linux CPU ABIs. Add deterministic native-call tests and isolate the optional procfs integration test.

This reports Zing ENOMEM honestly and prevents AArch64 or non-Linux Unix processes from invoking an unrelated syscall. Refs #15.
@peter-lawrey
peter-lawrey changed the base branch from ea to develop August 22, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix build on Zing

1 participant