Skip to content

Conversation

@okumin
Copy link
Contributor

@okumin okumin commented Dec 22, 2025

I see a long stack trace every time a REST server returns an error response, e.g., 404. This is the minimal reproduction.

$ gradle :iceberg-core:test --tests "org.apache.iceberg.rest.TestRESTCatalog.testSetNamespacePropertiesNamespaceDoesNotExist"
...
[qtp236002428-39] ERROR org.apache.iceberg.rest.RESTCatalogServlet - Error processing REST request
org.apache.iceberg.exceptions.RESTException: Unhandled error: ErrorResponse(code=404, type=NoSuchNamespaceException, message=Namespace does not exist: newdb)
org.apache.iceberg.exceptions.NoSuchNamespaceException: Namespace does not exist: newdb
	at org.apache.iceberg.inmemory.InMemoryCatalog.loadNamespaceMetadata(InMemoryCatalog.java:275)
	at org.apache.iceberg.rest.CatalogHandlers.updateNamespaceProperties(CatalogHandlers.java:218)
	at org.apache.iceberg.rest.RESTCatalogAdapter.handleRequest(RESTCatalogAdapter.java:242)
	at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
	at org.apache.iceberg.rest.RESTCatalogAdapter.handleRequest(RESTCatalogAdapter.java:165)
	at org.apache.iceberg.rest.RESTCatalogAdapter.execute(RESTCatalogAdapter.java:569)
	at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)

Or we can reproduce it by sending a request, e.g., curl http://localhost:8181/v1/namespaces/default/tables/test, against iceberg-rest-fixture.

% docker run --rm -p 8181:8181 apache/iceberg-rest-fixture:1.10.0
...
[qtp254749889-22] ERROR org.apache.iceberg.rest.RESTCatalogServlet - Error processing REST request
org.apache.iceberg.exceptions.RESTException: Unhandled error: ErrorResponse(code=404, type=NoSuchTableException, message=Table does not exist: default.test)
org.apache.iceberg.exceptions.NoSuchTableException: Table does not exist: default.test
	at org.apache.iceberg.BaseMetastoreCatalog.loadTable(BaseMetastoreCatalog.java:55)
	at org.apache.iceberg.rest.CatalogHandlers.loadTable(CatalogHandlers.java:329)
	at org.apache.iceberg.rest.RESTCatalogAdapter.handleRequest(RESTCatalogAdapter.java:420)
	at org.apache.iceberg.rest.RESTServerCatalogAdapter.handleRequest(RESTServerCatalogAdapter.java:42)
	at org.apache.iceberg.rest.RESTCatalogAdapter.execute(RESTCatalogAdapter.java:628)
	at org.apache.iceberg.rest.RESTCatalogAdapter.execute(RESTCatalogAdapter.java:609)
	at org.apache.iceberg.rest.RESTCatalogServlet.execute(RESTCatalogServlet.java:108)
  1. When an error happens, errorHandler is triggered
  2. The error handler constructs the error response, without throwing an exception
  3. The adapter throws a RESTException
  4. The servlet implementation attempts a non-local exit and logs the exception

Logging a stack trace for a 404 Not Found response is verbose in most use cases.

The first implementation of this pull request does not change the overall flow control. Ideally, RESTCatalogAdapter#execute should probably not throw a RESTException; however, it may require modifying BaseHTTPClient, so I opened this PR with a minimal change.

@github-actions github-actions bot added the core label Dec 22, 2025
@okumin okumin marked this pull request as ready for review December 23, 2025 23:39
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.

1 participant