-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
fix silent failures in dispatch loop from stalling the pipeline #32922
base: master
Are you sure you want to change the base?
Conversation
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment |
…ker harness to crash the JVM
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment |
}); | ||
|
||
try { | ||
dispatchLoopFuture.get(); |
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.
this is changing start() to be blocking.
If we want that we shoudl have clearer method name and also just get rid of the workProviderExecutor and use this thread directly.
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.
removed
SingleSourceWorkerHarness.GetWorkSender getWorkSender = | ||
SingleSourceWorkerHarness.GetWorkSender.forAppliance( | ||
() -> { | ||
throw expected; |
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'm confused why the test of this isn't causing the runtime to halt. It makes me think the unhandled exception handler isn't being called and this is just working because of the changes to make start() blocking and call get on the future().
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.
added test to ensure that the runtime is being terminated
private static ThreadFactory terminatingThreadFactory( | ||
ThreadFactoryBuilder threadFactoryBuilder, Logger logger) { | ||
return threadFactoryBuilder | ||
.setUncaughtExceptionHandler(new WorkerUncaughtExceptionHandler(logger)) |
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'm not sure this is working if the executor thread is catchign the exception and putting it in the future.
I think we might need instead to wrap the executor so that scheduled tasks are wrapped and then catch exceptions and call termination method like com/google/common/util/concurrent/WrappingExecutorService.java
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.
added to test to ensure that we are halting the JVM
back to you thank you! |
@@ -157,6 +157,19 @@ private static Optional<StreamingConfigTask> fetchConfigWithRetry( | |||
} | |||
} | |||
|
|||
private static Optional<ComputationConfig> createComputationConfig(StreamingConfigTask config) { |
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.
can we revert the unrelated change, to keep the diff small and on topic?
@@ -228,6 +228,22 @@ private static void shutdownExecutor(ScheduledExecutorService executor) { | |||
} | |||
} | |||
|
|||
// Calculates the PerWorkerMetrics reporting frequency, ensuring alignment with the |
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.
can we revert the unrelated change, to keep the diff small and on topic?
@@ -346,10 +348,7 @@ public static StreamingDataflowWorker fromOptions(DataflowWorkerHarnessOptions o | |||
.setSizeMb(options.getWorkerCacheMb()) | |||
.setSupportMapViaMultimap(options.isEnableStreamingEngine()) | |||
.build(); | |||
Function<String, ScheduledExecutorService> executorSupplier = | |||
threadName -> | |||
Executors.newSingleThreadScheduledExecutor( |
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 think changing Executors.newSingleThreadScheduledExecutor
to Executors.newSingleThreadExecutor
should fix the problem? We don't need to introduce a new Executor.
fix silent failures in dispatch loop from stalling the pipeline
changed all executors used by the Streaming harness to use
TerminatingExecutors
which attaches aWorkerUncaughtExceptionHandler
to all of the thread factories used to create anExecutor
/ExecutorService
. This means that any uncaught exception will terminate the JVM. This seems to be the original intention inDataflowWorkerHarnessHelper.initializeLogging()
since it attaches an uncaught exception handler that will terminate the JVM on uncaught exceptions, however that was only applied to raw threads.added test in
SingleSourceWorkerHarness
to ensure exception is propogated to main thread.WorkerUncaughtExceptionHandler
already has a unit test to ensure that it works.Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123
), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>
instead.CHANGES.md
with noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.