Skip to content

Open-API: Close backend catalog when stopping RESTCatalogServer - #17233

Draft
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/rest-catalog-server-close-backend-catalog
Draft

Open-API: Close backend catalog when stopping RESTCatalogServer#17233
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/rest-catalog-server-close-backend-catalog

Conversation

@thswlsqls

@thswlsqls thswlsqls commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Closes #17232

Summary

  • RESTCatalogServer.stop() only stopped the Jetty httpServer; the backend Catalog from initializeBackendCatalog() (a Closeable JdbcCatalog by default) was never closed, leaking its JDBC connection pool and FileIO.
  • RESTServerExtension registers RESTCatalogServer as a class-level JUnit fixture (RCK suite, Spark 3.5/4.0/4.1 TestBaseWithCatalog), so the leak accumulated per test class.
  • stop() now closes the backend catalog when Closeable — the "owner closes the backend" contract from RESTCatalogAdapter.close(), via the instanceof Closeable pattern in ParallelIterable.

Testing done

  • Added TestRESTCatalogServer#stopClosesBackendCatalog: starts a server on the default in-memory sqlite JdbcCatalog, stops it, and asserts the connection pool rejects further use (fails without the fix).
  • ./gradlew :iceberg-open-api:check — 1 test passed.
  • Not a REVAPI module (no src/main); no public API change.

AI Disclosure

  • Tool: Claude Code — used to analyze the code, implement the fix, and write the test.

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
thswlsqls marked this pull request as draft July 17, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open-API: RESTCatalogServer.stop() leaks the backend catalog

1 participant