Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix LogsCheckpoint thread interrupt race condition#6939

Merged
pditommaso merged 2 commits into
masterfrom
fix/logs-checkpoint-interrupt-race
Mar 23, 2026
Merged

Fix LogsCheckpoint thread interrupt race condition#6939
pditommaso merged 2 commits into
masterfrom
fix/logs-checkpoint-interrupt-race

Conversation

@pditommaso

Copy link
Copy Markdown
Member

Summary

  • Fix race condition in LogsCheckpoint.run() where saveFiles() was called with the thread interrupt flag already set after await() caught an InterruptedException
  • This caused the AWS SDK to throw AbortedException ("Thread was interrupted") during S3 uploads at workflow shutdown
  • Move the interrupt check to after await() returns and before saveFiles(), so the loop exits cleanly on shutdown

Test plan

  • Verify no AbortedException warnings in logs when running workflows with Tower/Seqera platform integration and remote work directory

🤖 Generated with Claude Code

Check interrupt flag after await() returns and before calling
saveFiles(), preventing the AWS SDK from seeing the interrupt
flag and throwing AbortedException during S3 uploads at shutdown.

Signed-off-by: Paolo Di Tommaso <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
@netlify

netlify Bot commented Mar 18, 2026

Copy link
Copy Markdown

Deploy Preview for nextflow-docs-staging ready!

Name Link
🔨 Latest commit 56d78b3
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/69c12c1ee69895000855f0c7
😎 Deploy Preview https://deploy-preview-6939--nextflow-docs-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@bentsherman

Copy link
Copy Markdown
Member

I feel like we have iterated on this code a dozen times trying to find the right logic 😅

@bentsherman bentsherman requested a review from jorgee March 20, 2026 15:05
@bentsherman

Copy link
Copy Markdown
Member

@jorgee requesting your review since you are looking into #6885 (not exactly the same but seems related)

@jorgee jorgee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR reduced the probability of the race condition but I think there is still a chance that the thread is interrupted during saving files. To fix it, we could add a synchronized block for handler.savefiles() and thread.interrupt() in onFlowComplete() and onFlowError().

@pditommaso

Copy link
Copy Markdown
Member Author

Please do

@jorgee jorgee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a lock between interrupt and save files to ensure log checkpoint thread is never interrupted during handler.saveFiles().

@pditommaso pditommaso merged commit 9d65b9e into master Mar 23, 2026
25 checks passed
@pditommaso pditommaso deleted the fix/logs-checkpoint-interrupt-race branch March 23, 2026 12:45
pditommaso added a commit that referenced this pull request Mar 30, 2026
* Fix LogsCheckpoint thread interrupt race condition

Check interrupt flag after await() returns and before calling
saveFiles(), preventing the AWS SDK from seeing the interrupt
flag and throwing AbortedException during S3 uploads at shutdown.


Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: jorgee <[email protected]>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Co-authored-by: jorgee <[email protected]>
bentsherman pushed a commit that referenced this pull request May 21, 2026
* Fix LogsCheckpoint thread interrupt race condition

Check interrupt flag after await() returns and before calling
saveFiles(), preventing the AWS SDK from seeing the interrupt
flag and throwing AbortedException during S3 uploads at shutdown.


Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: jorgee <[email protected]>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Co-authored-by: jorgee <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LogsCheckpoint thread re-sets interrupt flag in await(), causing empty console output files on GCS

3 participants