-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid catch (Throwable t)
in AmazonBedrockStreamingChatProcessor
#115715
Avoid catch (Throwable t)
in AmazonBedrockStreamingChatProcessor
#115715
Conversation
`CompletableFuture.runAsync` implicitly catches all `Throwable` instances thrown by the task, which includes `Error` instances that no reasonable application should catch. Moreover, discarding the return value from these methods means that any such `Error` will be ignored, allowing the JVM to carry on running in an invalid state. This commit replaces these trappy calls with more appropriate exception handling.
Pinging @elastic/ml-core (Team:ML) |
Hi @DaveCTurner, I've created a changelog YAML for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this
try { | ||
threadPool.executor(UTILITY_THREAD_POOL_NAME).execute(runnable); | ||
} catch (Exception e) { | ||
logger.error(Strings.format("failed to fork [%s] to utility thread pool", runnable), e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should have been handling the exception - I didn't think to do that initially, but seeing it explicitly caught like this is making me think we should
logger.error(Strings.format("failed to fork [%s] to utility thread pool", runnable), e); | |
logger.error(Strings.format("failed to fork [%s] to utility thread pool", runnable), e); | |
cancel(); | |
onError(e); |
We can either include that here (and I can follow up with a unit test) or I can follow up with that change outside of this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave that for you to do in a followup. In practice we can't really throw an exception here anyway because of how the UTILITY_THREAD_POOL_NAME
executor is configured today.
…lastic#115715) `CompletableFuture.runAsync` implicitly catches all `Throwable` instances thrown by the task, which includes `Error` instances that no reasonable application should catch. Moreover, discarding the return value from these methods means that any such `Error` will be ignored, allowing the JVM to carry on running in an invalid state. This commit replaces these trappy calls with more appropriate exception handling.
…lastic#115715) `CompletableFuture.runAsync` implicitly catches all `Throwable` instances thrown by the task, which includes `Error` instances that no reasonable application should catch. Moreover, discarding the return value from these methods means that any such `Error` will be ignored, allowing the JVM to carry on running in an invalid state. This commit replaces these trappy calls with more appropriate exception handling.
…115715) (#115790) `CompletableFuture.runAsync` implicitly catches all `Throwable` instances thrown by the task, which includes `Error` instances that no reasonable application should catch. Moreover, discarding the return value from these methods means that any such `Error` will be ignored, allowing the JVM to carry on running in an invalid state. This commit replaces these trappy calls with more appropriate exception handling.
…115715) (#115789) `CompletableFuture.runAsync` implicitly catches all `Throwable` instances thrown by the task, which includes `Error` instances that no reasonable application should catch. Moreover, discarding the return value from these methods means that any such `Error` will be ignored, allowing the JVM to carry on running in an invalid state. This commit replaces these trappy calls with more appropriate exception handling.
…lastic#115715) `CompletableFuture.runAsync` implicitly catches all `Throwable` instances thrown by the task, which includes `Error` instances that no reasonable application should catch. Moreover, discarding the return value from these methods means that any such `Error` will be ignored, allowing the JVM to carry on running in an invalid state. This commit replaces these trappy calls with more appropriate exception handling.
…lastic#115715) `CompletableFuture.runAsync` implicitly catches all `Throwable` instances thrown by the task, which includes `Error` instances that no reasonable application should catch. Moreover, discarding the return value from these methods means that any such `Error` will be ignored, allowing the JVM to carry on running in an invalid state. This commit replaces these trappy calls with more appropriate exception handling.
CompletableFuture.runAsync
implicitly catches allThrowable
instances thrown by the task, which includes
Error
instances that noreasonable application should catch. Moreover, discarding the return
value from these methods means that any such
Error
will be ignored,allowing the JVM to carry on running in an invalid state.
This commit replaces these trappy calls with more appropriate exception
handling.