{"record":{"id":"328c8a433db87a32","repo":"apache/beam","slug":"waiting-for-timeout-check-to-complete","errorCode":null,"errorMessage":"Waiting for timeout check to complete","messagePattern":"Waiting for timeout check to complete","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/sqs/SqsIO.java","lineNumber":669,"sourceCode":"      /** Submit entries of a {@link Batch} to the async write handler. */\n      private void submitEntries(Batch batch, boolean throwFailures) {\n        try {\n          handler.batchWrite(batch.queue, batch.getAndClose(), throwFailures);\n        } catch (RuntimeException e) {\n          throw e;\n        } catch (Throwable e) {\n          throw new RuntimeException(e);\n        }\n      }\n\n      public void finishBundle() throws Throwable {\n        if (expirationCheck != null) {\n          expirationCheck.cancel(false);\n          while (true) {\n            try {\n              expirationCheck.get(EXPIRATION_CHECK_TIMEOUT_SECS, TimeUnit.SECONDS);\n            } catch (TimeoutException e) {\n              LOG.warn(\"Waiting for timeout check to complete\");\n            } catch (CancellationException e) {\n              break; // scheduled checks completed after cancellation\n            }\n          }\n        }\n        // safe to write remaining batches without risking to encounter locked ones\n        checkState(batches.submitAll());\n        handler.waitForCompletion();\n      }\n\n      @Override\n      public void close() throws Exception {\n        sqs.close();\n        if (scheduler != null) {\n          scheduler.shutdown();\n        }\n      }\n","sourceCodeStart":651,"sourceCodeEnd":687,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/sqs/SqsIO.java#L651-L687","documentation":"On teardown, WriteBatches cancels its scheduled expiration check and then waits for any in-flight check future to finish before writing remaining batches (to avoid writing to locked/expired batches concurrently). If the check doesn't finish within EXPIRATION_CHECK_TIMEOUT_SECS, it logs this warning and waits again.","triggerScenarios":"Pipeline teardown while a scheduled SQS message-expiration check task is still executing; repeated get() timeouts mean the check task is stuck (e.g. blocked on an SQS API call) for longer than EXPIRATION_CHECK_TIMEOUT_SECS each attempt.","commonSituations":"SQS endpoint slowness or throttling at shutdown; very large batch pending while the check loop runs; executor starvation from other SQS writer tasks.","solutions":["No user fix required — the loop keeps waiting until the check completes or is cancelled; teardown continues afterwards","Reduce SQS client request timeouts so a stuck check fails fast instead of hanging","Check for SQS throttling/network problems at shutdown time","Ensure the writer isn't starved of threads by other concurrent sinks sharing an executor"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// wait pattern matching the library's\nwhile (true) {\n  try { future.get(timeout, TimeUnit.SECONDS); break; }\n  catch (TimeoutException e) { LOG.warn(\"still waiting for check\"); }\n  catch (CancellationException e) { break; }\n}","preventionTips":["Configure low SQS client timeouts so stuck checks fail fast","Avoid over-subscribing the executor running the expiration checks","Test pipeline teardown under simulated SQS throttling","Ensure batches are flushed before long-lived expiration checks start"],"tags":["sqs","shutdown","timeout","batch-write"],"backgroundTag":"request-timeout","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-15T02:17:10.978Z"}