syahra712 opened a new pull request, #146: URL: https://github.com/apache/solr-orbit/pull/146
### Description This is the second half of #138. It makes `jfr`, `gc`, `jit` and `heapdump` work on the `docker` pipeline, and wires `heapdump` into all three provisioned pipelines. It is stacked on #143. The first commit here is #143's, so the diff will shrink once that merges. **Logs out of the container.** I followed the approach from #138: the container writes to its own `/var/solr/logs`, and we copy that directory out before removing it. - `SolrDockerLauncher` no longer uses `--rm`. - `stop(log_dest=...)` runs `docker stop`, then `docker cp solr-orbit:/var/solr/logs/. <dest>`, then `docker rm -f`. The `rm` always runs, even if `stop` or `cp` fails. - For Docker, `_create_jvm_telemetry_devices` points the devices at `/var/solr/logs` and skips creating that path on the host (the new `create_log_root=False`). - The pipeline copies everything into `<test-run-dir>/telemetry/`, the same place the local pipelines write to. Solr's own `solr.log` comes along too. Nothing is mounted, so there are no host UID/permission issues. **Heap dump before stop.** `Heapdump` was never called by the real pipelines. - `_dump_heap_before_stop()` now runs in each pipeline's `finally`, just before Solr is stopped. - In Docker it runs `docker exec <container> jattach <pid> dumpheap /var/solr/logs/heap_at_exit_<pid>.hprof`. Thanks @janhoy for pointing out that the images ship `jattach`. It is the same tool `bin/solr` falls back to for thread dumps. - The PID is now taken from `pgrep -o -x java` inside the container. `docker inspect .State.Pid` gives a host-side PID, which `jattach` can't use. - Locally it uses `jmap`, falling back to `jattach`, and logs a warning if neither is on the `PATH`. **`jit` on JDK 17+.** The end-to-end run turned up a separate bug: `-XX:+TraceClassLoading` is obsolete since JDK 17 ([JDK-8256718](https://bugs.openjdk.org/browse/JDK-8256718)), so with `--telemetry jit` the JVM exits with `Unrecognized VM option 'TraceClassLoading'`. This affects the local pipelines in #143 as well. I replaced it with `-Xlog:class+load=info`, the documented replacement ([JDK-8257429](https://bugs.openjdk.org/browse/JDK-8257429)) and what JITWatch recommends for Java 9+. Solr 9 needs Java 11+, so the flag is always available. One thing I left as it is: `jit` also sets `-XX:+PrintAssembly`, which slows Solr startup a lot. On `solr:9` it took 93–143s to become ready (25s without it) and `jit.log` grew past 100 MB. The Docker launcher's default `startup_timeout` is 60s, so `--telemetry jit` on Docker will usually time out. Dropping `PrintAssembly` would fix that, and without `hsdis` its output isn't very useful anyway. I can do that here or in a follow-up if you agree. The reference and user-guide telemetry docs are updated. ### Issues Resolved Part of #138 (with #143 this covers every provisioned pipeline) ### Testing - [x] New functionality includes testing Unit tests: - `tests/unit/solr/test_provisioner.py`: no `--rm`; the PID comes from `pgrep` (not `docker inspect`); `stop()` runs stop → cp → rm in that order; there is no `cp` without `log_dest`; `rm` still runs when `stop` fails. - `tests/unit/test_telemetry.py`: the Docker heap dump runs `jattach` in the container; the local path picks `jmap`, falls back to `jattach`, and skips with neither; devices don't create a host directory when `create_log_root=False`; `jit` no longer emits `-XX:+TraceClassLoading`. - `tests/test_execution_orchestrator_test.py`: the Docker devices point inside the container; from-distribution dumps the heap before `stop()`; the Docker pipeline passes the devices, dumps, then calls `stop(log_dest=<telemetry dir>)`. With the `solrorbit/` changes reverted, 16 of these fail. End to end against `solr:9` (Temurin 17), driving `SolrDockerLauncher`, `_create_jvm_telemetry_devices` and `_dump_heap_before_stop` the way the `docker` pipeline does: - `jfr,gc,heapdump` with the default 60s timeout: `gc.log`, `profile.jfr`, `heap_at_exit_14.hprof` (71 MB) and `solr.log` ended up in the telemetry dir. No `/var/solr` was created on the host, and no container was left behind. - `jfr,gc,jit,heapdump` with a 400s timeout: same result, plus `jit.log` (147 MB). - Startup failure: the dump is skipped with a warning, and the logs are still copied out before the container is removed. The full `tests/` suite passes locally on Python 3.13 (1195 passed, 5 skipped), and so does `ruff check .`. I haven't run `it/`. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
