Skip to content

Commit a45b0df

Browse files
authored
Remove cancelled tasks from ReadOperation queue when shutting down (#34335)
* Remove cancelled tasks from ReadOperation queue when shutting down * Try shutdowNow * spotless
1 parent 50b2787 commit a45b0df

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/common/worker

runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/common/worker/ReadOperation.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,16 @@ public void run() {
225225
if (!scheduler.isTerminated()) {
226226
LOG.error(
227227
"Failed to terminate periodic progress reporting in 1 minute. "
228-
+ "Waiting for it to terminate indefinitely...");
229-
scheduler.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
228+
+ "Waiting for it to terminate 10 minutes before forcing");
229+
scheduler.awaitTermination(10, TimeUnit.MINUTES);
230+
if (!scheduler.isTerminated()) {
231+
LOG.error(
232+
"Failed to terminate periodic progress reporting in 10 "
233+
+ "minutes. Trying to force termination then waiting "
234+
+ "indefinitely...");
235+
scheduler.shutdownNow();
236+
scheduler.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
237+
}
230238
LOG.info("Periodic progress reporting terminated.");
231239
}
232240
}

0 commit comments

Comments
 (0)