Skip to content

Stop Neo4j dying on a modern host kernel - #79

Merged
adamjohnwright merged 1 commit into
mainfrom
fix/neo4j-cgroup-v2
Sep 15, 2026
Merged

adamjohnwright merged 1 commit into
mainfrom
fix/neo4j-cgroup-v2

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Symptom

reactome-neo4j sits in a restart loop and never comes up:

Exception in thread "main" java.lang.ExceptionInInitializerError
	at org.neo4j.memory.MachineMemory$1.getTotalPhysicalMemory
Caused by: java.lang.NullPointerException
	at java.base/jdk.internal.platform.cgroupv2.CgroupV2Subsystem.getInstance

Cause

The pinned graphdb:Release97 image ships JDK 11.0.16, whose container-metrics probe cannot read cgroup v2 as newer kernels lay it out. The NPE happens inside a static initialiser, so it surfaces as ExceptionInInitializerError before Neo4j starts. Nothing in the log names a cause a reader would connect to a host kernel upgrade — this one cost a while to find.

Fix

One environment entry. -XX:-UseContainerSupport skips exactly that probe.

The heap is pinned on the line above (NEO4J_dbms_memory_heap_maxSize=8g), so container-aware sizing was only ever going to compute a number we already override. Nothing is lost, and the flag is inert on kernels where the probe works.

No image change. The tag is untouched; this is a runtime setting that Neo4j's entrypoint maps from NEO4J_* into dbms.jvm.additional in neo4j.conf.

Verified, not assumed

On the running JVM:

/usr/local/openjdk-11/bin/java ... -XX:-UseContainerSupport

and in the container's config:

dbms.jvm.additional=-XX:-UseContainerSupport

Neo4j then logs Started. with Bolt on 7687, and a real query against Release97 returns data.

Note

The same host upgrade removed Python 3.12 (only 3.14 remains), so poetry install cannot build scipy 1.15.3 locally. CI runs 3.10–3.12 and is unaffected. Not addressed here.

🤖 Generated with Claude Code

The pinned graphdb:Release97 image ships JDK 11.0.16, whose container-metrics
probe cannot read cgroup v2 as newer kernels lay it out. It throws a
NullPointerException from CgroupV2Subsystem.getInstance, inside a static
initialiser, so Neo4j dies with ExceptionInInitializerError before it starts
and the container sits in a restart loop. Nothing in the logs names a cause a
reader would connect to the host kernel.

Disabling container support skips exactly that probe. The heap is pinned on the
line above, so container-aware sizing was only ever going to compute a number
we already override — there is nothing to lose and it is inert on older
kernels.

Verified on the running JVM rather than assumed:
  /usr/local/openjdk-11/bin/java ... -XX:-UseContainerSupport

No image change: the tag is untouched and this is a runtime setting, which
Neo4j's entrypoint maps from NEO4J_* into dbms.jvm.additional in neo4j.conf.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit f5aca53 into main Sep 15, 2026
4 checks passed
@adamjohnwright
adamjohnwright deleted the fix/neo4j-cgroup-v2 branch September 15, 2026 15:49
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.

1 participant