imbajin opened a new pull request, #3347: URL: https://github.com/apache/hugegraph/pull/3347
## Purpose of the PR A background task can outlive both Gremlin and REST graph-close attempts during Server shutdown. Previously, shutdown then stopped the task database worker while the graph and its transaction were still retained. This follows up on [the shutdown lifecycle review](https://github.com/hugegraph/hugegraph/pull/279#discussion_r4240438972) and [ASF #3302](https://github.com/apache/hugegraph/pull/3302). Org staging PR: https://github.com/hugegraph/hugegraph/pull/316. ## Main Changes After task workers drain, retry retained graph closes through the existing scheduler registry before stopping task database and event workers. Treat an already terminated cron executor as a completed dispatch barrier. Each executor wait checks actual termination on explicit retry; a failed or interrupted wait stops the later shutdown stages. A graph-close failure still attempts cleanup of other graphs and leaves the task database executor available for an explicit retry. Store-close notifications finish before the shared event executor stops. ## Verifying these changes - [ ] Trivial rework / code cleanup without any test coverage. (No Need) - [ ] Already covered by existing tests. - [x] Need tests and can be verified as follows: - Reproduced the missing final close through `HugeGraphServer.stop()` before the fix. The regression now verifies task completion persistence, retained graph and scheduler closure, task database owner release, and store-close event delivery. - Added real distributed-scheduler shutdown coverage and bounded timeout/interruption retry tests for the task database, ephemeral, schema and OLAP executors. - Passed `HugeFactoryTest`, `StandardTaskAdmissionTest` and `DistributedTaskAdmissionTest`, `mvn editorconfig:format`, root `mvn clean compile -Dmaven.javadoc.skip=true`, and `git diff --check`. ## Does this PR potentially affect the following parts? - [ ] Dependencies - [ ] Modify configurations - [ ] The public API - [x] Other affects: Server shutdown lifecycle. - [ ] Nope ## Documentation Status - [ ] `Doc - TODO`: required documentation is pending; complete it before merging. - [x] `Doc - Done`: documentation is included here or linked below. - [ ] `Doc - No Need`: no user-visible documentation is affected. Documentation files in this PR: [`docs/server-runtime.md`](https://github.com/hugegraph/hugegraph/blob/fix/shutdown-retained-cleanup/docs/server-runtime.md). -- 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]
