Watchdog waits on executor shutdown in awaitTermination, even if ExecutorProvider has shouldAutoClose == false #1858
Comments
…leapis#1858) BREAKING CHANGE: change WatchdogProvider interface to require whether or not to shut the executor down
I tested in my local that Watchdog is not shutting down Executor, the implementation of Based on the linked PR, I guess the problem you are trying to solve is that you are using |
We are using awaitTermination at the client level, which causes watchdogs to await, which depends on the await of the underlying executor. Ultimately, if the executor shouldn't be shutdown, I don't think we should await on the executor within the watchdog either |
I agree the WatchDog should not wait on the executor to shutdown if the executor is provided by an But that's a different problem from what you are describing here, based on the title of issue and the comment in the PR, are you seeing the Watchdog try to shutdown the Executor even if |
yep. When we provide this executor: https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/util/UnboundedScheduledExecutorService.java and configure the executor provider like this: https://github.com/johnjcasey/beam/blob/feature/21368-re-enable-unboundedScheduledExecutor/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryServicesImpl.java#L1503 we see the issue when we later call .awaitTermination https://github.com/johnjcasey/beam/blob/feature/21368-re-enable-unboundedScheduledExecutor/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryServicesImpl.java#L1414 |
I still couldn't reproduce it with
|
Are you creating a BQ client? the newWriteClient in the above code is a BigQueryWriteClient, for context. It wraps a ClientContext, and calls forwards the various shutdown methods to the ClientContext.backgroundResources |
Yes, I'm creating a |
Ah! The problem we were seeing is that our await termination is hanging for the duration of the timeout provided (60s), because the underlying executor isn't getting terminated. |
but this await termination call shouldn't wait for the executor to be terminated |
Sorry I've been explaining some of the issues poorly |
@johnjcasey No worries, can you please update the title and description to match the issue you were observing? I'll prepare a fix in the mean time. |
Environment details
Steps to reproduce
The text was updated successfully, but these errors were encountered: