Skip to content

Fix double-close race on static client in OpenSearch AbstractSpout#1864

Merged
jnioche merged 1 commit intomainfrom
fix-abstract-spout-double-close
Apr 2, 2026
Merged

Fix double-close race on static client in OpenSearch AbstractSpout#1864
jnioche merged 1 commit intomainfrom
fix-abstract-spout-double-close

Conversation

@jnioche
Copy link
Copy Markdown
Contributor

@jnioche jnioche commented Apr 2, 2026

Summary

  • The static client field is initialized under synchronized(AbstractSpout.class), but close() was unsynchronized, allowing multiple spout instances to close the same client concurrently
  • client was never set to null after closing, so the null check provided no protection against double-close
  • Synchronize close() on AbstractSpout.class and set client = null after closing

Test plan

  • Verify compilation with mvn compile -pl external/opensearch -am
  • Verify existing OpenSearch integration tests pass

🤖 Generated with Claude Code

The static client field is initialized under synchronized(AbstractSpout.class),
but close() was unsynchronized, allowing multiple spout instances to close the
same client concurrently. Additionally, client was never set to null after
closing, so the null check provided no protection against double-close.

Synchronize close() on AbstractSpout.class and set client to null after closing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jnioche jnioche added the bug label Apr 2, 2026
@rzo1 rzo1 added this to the 3.5.2 milestone Apr 2, 2026
@jnioche jnioche merged commit 45a9755 into main Apr 2, 2026
2 checks passed
@jnioche jnioche deleted the fix-abstract-spout-double-close branch April 2, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants