matrei opened a new pull request, #16357: URL: https://github.com/apache/grails-core/pull/16357
Fixes #16354 ## Problem `GrailsDataMongoTckManager.destroy()` dropped all databases after each feature, so the datastore of the next feature created every collection and index of the ~25 default TCK domain classes (plus the spec's own) again. WiredTiger keeps the files of dropped collections open until its next checkpoint, so the number of open files in mongod grows with the number of features in a spec. Under Docker's default soft `nofile` limit of 1024, a spec with enough features (`NamedQuerySpec`, 38 features) drives mongod into `EMFILE`, it aborts with exit code 14, and the test worker then waits in server selection indefinitely, so the Gradle run never finishes. ## Changes - `destroy()` now removes the documents of each collection instead of dropping the databases. Collections and their indexes stay in place within a spec (each spec has its own container), so the next feature's datastore finds them and mongod creates no new files. Collections that do not support deletes (e.g. capped ones) are still dropped. The datastore is still created per feature, so JVM-side isolation is unchanged. - The container is started with its `nofile` limit raised to 65536. This is belt and braces: a crashed mongod hangs the build rather than failing it. - `GrailsDataMongoTckManagerSpec` gains two features: documents are gone but collections survive `cleanup()`, and the container's `ulimit -n` is above the Docker default. ## Verification Peak open files in mongod while running `NamedQuerySpec` (sampled from `/proc/<mongod>/fd`, raised ulimit in both runs so the baseline can finish): | `destroy()` | peak open files | |---|---| | drops databases (before) | 2139 | | clears documents (this PR) | 183 | Full `:grails-data-mongodb-core:test` run on a stock Docker install: 182 specs, 546 tests, 0 failures, 0 errors, 23 skipped; none of the 222 recorded container exits was `exit=14`. ## Note on 8.0.x A correction to the issue text: the 8.0.x manager also creates a datastore per feature. It is not affected because its domain class set starts empty and each spec registers only its own classes via `registerDomainClasses(...)`. Doing the same on 7.0.x would mean touching every TCK spec, hence the narrower change here. The same `destroy()` change would still reduce churn on 8.0.x and should merge forward cleanly. -- 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]
