Repository navigation
Python runtime fixes in src: serialized start_jvm(), heap default, log directory, XML limits, read-only open, async docs - #27
Merged
Conversation
…g directory, XML limits, read-only open, async docs Ports the runtime-fix group of #19 from humemai/arcadedb-embedded-python bindings/python, with its tests: - start_jvm() holds a lock, so threads whose first call is create_database() or open_database() no longer race into jpype.startJVM() (humemai #454) - default heap is 50 percent of the RAM the JVM sees (container limit inside a container) instead of 4g; an -Xms above the maximum heap raises ValueError before the JVM starts (humemai #420) - engine log, crash log and a rendered logging.properties go to a per-user log directory (ARCADEDB_LOG_DIR) instead of ./log (humemai #407) - the JDK XML entity limits stay on by default; import_documents(disable_xml_limits=True) lifts them for one call, and a limit error names the option (humemai #407) - open_database(read_only=...), DatabaseFactory.open(read_only=...), Database.is_read_only() (humemai #385) - AsyncExecutor docstrings say what each completion signal means, with tests (humemai #405) Not included: SIGINT and SIGTERM handling (#26), Python functions and record events, the polyglot engine default, the AOT cache. Refs #19 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 tasks
…GraalVM language (humemai#409) The wheel excludes js-language, truffle, icu4j and regex (scripts/jar_exclusions.txt), so the polyglot engine only logs 'no languages found' at the first SQL command. -Darcadedb.polyglotEngineEnabled=false is added unless the caller sets the flag; the old WarnInterpreterOnly flag goes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 24, 2026
Merged
Merged
The only conflict was src/arcadedb_embedded/jvm.py, where both sides added the _LOGGER line (main with #26 signals, this branch with the log directory work); kept one _LOGGER and the blank line before _JVM_CONFIG. The signal restore from main and this branch's start lock, heap default, log directory and XML limits all stay. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Part of #19, the "Python runtime fixes in
src/" group, ported by hand from humemai/arcadedb-embedded-pythonbindings/python(origin/main at a9ed1284cf) with their tests. Based on currentmain; black, isort and bandit run with this repo's config.What is ported
start_jvm():start_jvm()holds a re-entrant lock, so threads whose first call iscreate_database()oropen_database()no longer race intojpype.startJVM()(all but one failed with "Failed to start JVM", also with the GIL). Source: humemai#454 (only thestart_jvmlock; the JPype proxy-class part belongs to the callbacks feature). Test:tests/test_free_threading.py(many threads on one database and one database each, compared with a sequential run).start_jvm(heap_size=None)now adds-XX:MaxRAMPercentage=50(the container limit inside a container) instead of-Xmx4g. An explicitheap_sizealways wins; a user-Xmxor other max-heap flag is kept; no-Xmsis added; an-Xmslarger than the maximum heap raisesValueErrorbefore the JVM starts (the JVM would otherwise end the process). Source: humemai#420. Tests:tests/test_jvm.py,tests/test_jvm_args.py.logging.propertiesgo to a per-user directory (ARCADEDB_LOG_DIR, else the platform state directory, with a temp-dir fallback) instead of./login the working directory.jvm_argsandARCADEDB_JVM_ERROR_FILEstill win. Source: humemai#407. Test:tests/test_log_dir.py.start_jvm(disable_xml_limits=...)now defaults to False (the JDK entity limits stay on).Database.import_documents(disable_xml_limits=True)lifts them for that one call and restores them afterwards; an import that hits a limit raises anArcadeDBErrornaming the option. Source: humemai#407. Test:tests/test_xml_limits.py.open_database(path, read_only=True),DatabaseFactory.open(read_only=True)andDatabase.is_read_only(). Source: humemai#385. Test:tests/test_open_read_only.py.on_ok,wait_completion()) and that a WAL-off batch can still be lost in a crash. Source: humemai#405. Tests added totests/test_async_executor.py(signal order).start_jvm()adds-Darcadedb.polyglotEngineEnabled=false(instead of-Dpolyglot.engine.WarnInterpreterOnly=false) unlessjvm_argsorARCADEDB_JVM_ARGSset the flag, because the wheel ships no GraalVM language and the engine would only log "no languages found" at the first SQL command. Source: humemai#409 (bc93f97a67). Test:tests/test_jvm_args.py. The matchingtest_polyglot_engine_is_off_while_no_graalvm_language_shipsintests/test_jar_closure.pyarrives with Port the JRE module trim, Jackson/snappy/commons-math3 jars and the jar closure test (#19) #28 (JRE trim and jar closure); this default assumes the jar exclusions of that group, so merge this after Port the JRE module trim, Jackson/snappy/commons-math3 jars and the jar closure test (#19) #28 or together with it../log/.Not included
KeyboardInterrupt: SIGINT and SIGTERM handling is in fix: give SIGINT and SIGTERM back to Python after the JVM starts #26. This PR leavesinterruptand its docstring as onmain, so the two do not conflict.Document.save()anddelete()wrapping (features group, humemai#391). Because of this,Document.save()on a read-only database raises the engine's own exception, andtest_open_read_only.pyexpects that.server.py, build scripts, docs pages, the native wheel and the rest of the tests (other groups of Tracking: porting the rest of the humemai bindings work #19).test_free_threading.pythe Python-function and event probes are guarded byhasattr(db, "register_function"), so they stay inactive until the features group lands; the proxy-class scenario was left out.Tests run
Tests need a built wheel, so I overlaid this branch's
src/arcadedb_embedded/*.pyon an existing 26.11.1.dev0 wheel's unzipped contents (jars, JRE and bridge jar as built) and ran pytest from this checkout withPYTHONPATHpointing at the overlay, as for #26. Python 3.12, Linux amd64.test_jvm,test_jvm_args,test_log_dir,test_xml_limits,test_open_read_only,test_async_executor,test_free_threading,test_importer_api,test_core,test_logging_helper): 133 passed, 1 skipped (107 passed, 1 skipped on the re-run of the JVM-argument, log, XML, read-only, importer and core files after the polyglot commit) (pandas not installed in the overlay environment).tests/directory except the wheel-size, wheel-tag and jar-provenance tests and theserver_wiremarker: 1050 passed, 6 failed, 20 skipped. The 6 failures and the skips need pandas, pyarrow or requests, which the overlay environment lacks; none touches the changed code.python -m bandit -c pyproject.toml -r src tests --severity-level low --confidence-level low: no issues. The files parse on Python 3.10.CI on the real wheel across the matrix is the check for Python 3.10, 3.13, 3.14, Windows and macOS.
🤖 Generated with Claude Code