becketqin commented on code in PR #26205: URL: https://github.com/apache/flink/pull/26205#discussion_r1972562795
########## flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/source/reader/fetcher/SplitFetcherManager.java: ########## @@ -269,19 +271,32 @@ public synchronized void close(long timeoutMs) throws Exception { // fetcher threads blocking on putting batches into the element queue. executors.submit( () -> { - while (fetchersToShutDown.get() > 0 - && System.currentTimeMillis() - startTime < timeoutMs) { - elementsQueue - .getAvailabilityFuture() - .thenRun(() -> elementsQueue.poll().recycle()); + long timeElapsed = System.currentTimeMillis() - startTime; + while (fetchersToShutDown.get() > 0 && timeElapsed < timeoutMs) { + try { + elementsQueue + .getAvailabilityFuture() + .thenRun(() -> elementsQueue.poll().recycle()) + .get(timeoutMs - timeElapsed, TimeUnit.MILLISECONDS); + } catch (ExecutionException ee) { + // Ignore the exception and continue. + } catch (Exception e) { + LOG.warn( + "Received exception when waiting for the fetchers to " + + "shutdown.", + e); + break; + } + timeElapsed = System.currentTimeMillis() - startTime; Review Comment: Exactly, the await termination `LOG.warn()` would catch it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org