Open-API: Close backend catalog when stopping RESTCatalogServer - #17233
Draft
thswlsqls wants to merge 1 commit into
Draft
Open-API: Close backend catalog when stopping RESTCatalogServer#17233thswlsqls wants to merge 1 commit into
thswlsqls wants to merge 1 commit into
Conversation
RESTCatalogServer.stop() only stopped the Jetty httpServer; the backend Catalog created in initializeBackendCatalog() (a Closeable JdbcCatalog by default) was never closed, leaking its JDBC connection pool and FileIO on every RESTServerExtension teardown. Keep the CatalogContext as a field and close the backend catalog in stop() when it is Closeable, following the instanceof Closeable pattern already used in ParallelIterable. Generated-by: Claude Code
thswlsqls
marked this pull request as draft
July 17, 2026 11:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #17232
Summary
RESTCatalogServer.stop()only stopped the JettyhttpServer; the backendCatalogfrominitializeBackendCatalog()(aCloseableJdbcCatalogby default) was never closed, leaking its JDBC connection pool andFileIO.RESTServerExtensionregistersRESTCatalogServeras a class-level JUnit fixture (RCK suite, Spark 3.5/4.0/4.1TestBaseWithCatalog), so the leak accumulated per test class.stop()now closes the backend catalog whenCloseable— the "owner closes the backend" contract fromRESTCatalogAdapter.close(), via theinstanceof Closeablepattern inParallelIterable.Testing done
TestRESTCatalogServer#stopClosesBackendCatalog: starts a server on the default in-memory sqliteJdbcCatalog, stops it, and asserts the connection pool rejects further use (fails without the fix)../gradlew :iceberg-open-api:check— 1 test passed.src/main); no public API change.AI Disclosure