-
Notifications
You must be signed in to change notification settings - Fork 91
Description
When there is an unexpected error (ie, a non-StatusRuntimeException) in the export for io.deephaven.server.session.TicketRouter#flightInfoFor, we fail to properly pass that information to a client. This is relevant in io.deephaven.server.arrow.FlightServiceGrpcImpl#getFlightInfo / io.deephaven.server.arrow.FlightServiceGrpcImpl#getSchema, where we internally setup a two step export chain.
For example, the "unexpected error" logged on the server
[DeephavenApiServer-Scheduler-Concurrent-1] ERROR io.deephaven.server.session.SessionState - Internal Error 'eaffec8e-32fa-466e-ae28-5abfe31c0e7d' org.apache.calcite.runtime.CalciteContextException: From line 1, column 13 to line 1, column 16: Object 'fake' not found
...
at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:507)
...
at io.deephaven.server.flightsql.FlightSqlResolver.executeCommand(FlightSqlResolver.java:371)
at io.deephaven.server.flightsql.FlightSqlResolver.lambda$flightInfoFor$0(FlightSqlResolver.java:240)
at io.deephaven.server.session.SessionState$ExportObject.doExport(SessionState.java:1003)
...
at io.deephaven.server.runner.scheduler.SchedulerModule$ThreadFactory.lambda$newThread$0(SchedulerModule.java:100)
at java.base/java.lang.Thread.run(Thread.java:829)
results in a very opaque error to the user:
org.apache.arrow.flight.FlightRuntimeException: INVALID_ARGUMENT: Export in state DEPENDENCY_FAILED
...
It may be the case that this usage of exports is "special" (at least different than the typical table operation use case) since we are dealing with internally created exports that the user doesn't know about.
If the following instanceof check is commented out (as illustrated)
private synchronized void onDependencyFailure(final ExportObject<?> parent) {
errorId = parent.errorId;
// if (parent.caughtException instanceof StatusRuntimeException) {
caughtException = parent.caughtException;
// }the error message becomes much more reasonable (with the reference to the error)
org.apache.arrow.flight.FlightRuntimeException: INVALID_ARGUMENT: Details Logged w/ID 'feb1b0fa-0f9e-49bc-831b-6998018acbf5'
...
I'm not sure if this propagation of parent exception is universally acceptable; or if we want to make it configurable for these two cases; or if there is a better solution to get a better error message to the client.
For reference, the construction of the exports looks something like:
final SessionState.ExportObject<Flight.FlightInfo> export =
ticketRouter.flightInfoFor(session, request, "request");
if (session != null) {
session.nonExport()
.queryPerformanceRecorder(queryPerformanceRecorder)
.require(export)
.onError(responseObserver)
.submit(() -> {
responseObserver.onNext(export.get());
responseObserver.onCompleted();
});
return;
}