Repository navigation
Conversation
…owns when the console is off On Windows the runtime caches the OS handle of stdout and stderr at start-up. A host that redirects fd 1 or 2 later closes it, a database page file opened afterwards can get the same handle value, and the next System.out or System.err write lands in the page file (run 40250615309: Invalid position 793803132 (size=65536)). The JVM twin of #78, which removed the JUL console handler but not the other Java writers. start_jvm() now points both streams at arcadedb-stdio.log in the log directory right after startJVM, when the console is off (Windows default, or ARCADEDB_LOG_CONSOLE=0). The test repeats redirect, index, reopen and query ten times in one child, prints a Java probe after every step and scans every database file. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This branch has not been deployed
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
The JVM twin of #78. #78 removed the JUL console handler on Windows, but Java-level writes to
System.outandSystem.errstill use the OS handle that the runtime cached at start-up. With the console off (the default on Windows, orARCADEDB_LOG_CONSOLE=0),start_jvm()now replaces both streams, right afterstartJVM, with onePrintStreamonarcadedb-stdio.login the log directory (_logdir.stdio_log_path()). The file is opened by the library, so no cached handle is involved, whatever the host does with fd 1 and 2.Evidence
Dispatch run 40250615309 (
test-jvm.ymlon the PR #87 branchwindows-default-capture), job 121341603694, Windows Python 3.13:tests/test_log_redirect.py::test_redirect_with_the_console_off_sends_nothing_to_the_redirect_targetfailed withArcadeDBError: Reading the result set failed: java.lang.IllegalArgumentException: Invalid position 793803132 (size=65536), which is text read as a page position, the #78 signature. The other Windows legs of that run, and 3 of the 4 legs of the other run, passed: it is intermittent.The
WARNING: Using incubator modules: jdk.incubator.vectorin that failure message is not a leak into the redirect target. The child starts the JVM before it redirects, so the runtime prints that line to the parent's pipe (proc.stderr=b'WARNING: Using incubator modules: jdk.incubator.vector\r\n'in the log), and the old assertion message joined stdout, stderr and the redirect target into one text. The test needs no weaker expectation: the new message names each part. A host that redirects fd 2 before it starts the JVM does get that one line in its own target, which is its choice. Nothing the library prints afterstartJVMcan reach it.Design
ARCADEDB_LOG_CONSOLE=0asks for the console off, on any platform. The default on Linux and macOS is unchanged: the runtime writes to fd 1 and 2 by number there and follows a redirect. Tying it to the console setting (not tosys.platform) keeps one rule, and lets the Linux CI exercise the code.arcadedb-stdio.log, notarcadedb.log: the engine's file handler owns and rotates that one, and on Windows renaming a file that another handle holds open fails. Several processes that share a log directory append to the same file; a write is small.ARCADEDB_LOG_CONSOLE=1on Windows keeps the runtime's own streams, so the risk stays; it is documented (jvm.start_jvm,_logdir,docs/.../how-to/logs.adoc). ReopeningCONOUT$is not done: it would ignore a redirect that the host set up on purpose before the start.Tests
tests/test_log_redirect.pyis stronger on every build:ARCADEDB_REDIRECT_REPEATStimes in one process (default 10), and after every step prints a probe through Java'sSystem.outandSystem.err. A probe is a write through the cached handle that lands in a page file whenever a database file owns the handle value, with no log line needed.arcadedb-stdio.logmust hold every probe, from both streams (exact count).Without the fix the console-off redirect test and
test_console_log_can_be_turned_offfail on Linux too (the probes go to fd 1 and 2); with it all 21 tests pass.Checks run
black, isort
--profile black, Bandit 1.9.4 (-c pyproject.toml -r src tests --severity-level low --confidence-level low, clean),scripts/check_no_embedded_name.py, andtests/test_log_redirect.pyon Linux (Python 3.14, engine 26.10.2 jars). The Windows proof (bar: 0 failures, no log text in any database file):test-jvm.ymldispatched twice on this branch: runs 40252284414 and 40252287194 (the pull_request run is 40252214662).tests/test_log_redirect.pyper leg with pytest's default capture, with and without the fix (jvm.pyfrom main), at 1 and at 10 repeats per child. The numbers are in the first comment.🤖 Generated with Claude Code