[#15] Fix build on Zing - #89
Draft
peter-lawrey wants to merge 5 commits into
Draft
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Local
db33d82prevents falsemlocksuccess 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 --checkagainstea: passed..pr/scaffolding and local workspace paths: removed.Tracking
Fixes #15