diff --git a/Dockerfile b/Dockerfile index abfce70a5..db5285a66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -79,8 +79,6 @@ ENV JAVA_TOOL_OPTIONS="-XX:+UseShenandoahGC \ -XX:MaxRAMPercentage=60.0 \ -XX:InitialRAMPercentage=8.0 \ -XX:+ExitOnOutOfMemoryError \ - -XX:+HeapDumpOnOutOfMemoryError \ - -XX:HeapDumpPath=/tmp/heapdump.hprof \ -XX:MaxMetaspaceSize=256m \ -XX:ReservedCodeCacheSize=48m \ -Xss512k \ diff --git a/README.md b/README.md index 84274e56f..7e7d0b312 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,19 @@ docker compose up -d Open http://localhost:6060, create your admin account, and start building your library. (All libraries must be created within directories mounted on the host, e.g. the `/books/` directory in the sample `docker-compose.yml` above.) +#### Optional: Capture Heap Dumps for OOM Debugging + +Heap dumps are disabled by default. To enable them temporarily, add the following environment variable to the `grimmory` service: + +```yaml +services: + grimmory: + environment: + - JDK_JAVA_OPTIONS=-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/app/data +``` + +The JVM creates a PID-specific `.hprof` file in the mounted `/app/data` directory. Remove the option after collecting the diagnostic data because heap dumps can be large and contain sensitive application data. + Additional deployment examples: - Docker Compose: [`deploy/compose/docker-compose.yml`](deploy/compose/docker-compose.yml) diff --git a/deploy/compose/docker-compose.yml b/deploy/compose/docker-compose.yml index dba53964a..ebf56ac0b 100644 --- a/deploy/compose/docker-compose.yml +++ b/deploy/compose/docker-compose.yml @@ -23,7 +23,10 @@ services: # ALLOWED_ORIGINS= # Override JVM memory defaults (the image ships sensible defaults for ~512 MB heap). # Uncomment and adjust if you want a tighter or looser cap: - # JAVA_TOOL_OPTIONS=-Xmx256m + # - JDK_JAVA_OPTIONS=-Xmx256m + # Heap dumps are disabled by default. Enable them only when debugging an OOM: + # The JVM creates a PID-specific .hprof file in /app/data. + # - JDK_JAVA_OPTIONS=-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/app/data depends_on: mariadb: condition: service_healthy