Skip to content

Add bolt-level timeout for fetcher threads#1861

Merged
jnioche merged 2 commits intomainfrom
fetch-timeout-bolt
Apr 1, 2026
Merged

Add bolt-level timeout for fetcher threads#1861
jnioche merged 2 commits intomainfrom
fetch-timeout-bolt

Conversation

@jnioche
Copy link
Copy Markdown
Contributor

@jnioche jnioche commented Apr 1, 2026

Summary

  • Adds a configurable hard timeout (fetcher.thread.timeout) that wraps protocol.getProtocolOutput() calls in both FetcherBolt and SimpleFetcherBolt
  • When a fetch exceeds the timeout, the protocol thread is interrupted, the URL is marked as FETCH_ERROR, and the fetcher thread moves on to the next item
  • Disabled by default (-1), relying on protocol-level socket timeouts only

Previously, if the protocol layer hung beyond socket timeouts (due to client library bugs, misconfigured timeouts, or misbehaving proxies), fetcher threads would block indefinitely with no recovery mechanism.

Fixes #996

Test plan

  • New testThreadTimeout test in AbstractFetcherBoltTest (inherited by both FetcherBoltTest and SimpleFetcherBoltTest) — uses WireMock with a 10s delay and a 2s bolt timeout to verify the thread is reclaimed and a FETCH_ERROR is emitted
  • All 221 core tests pass

🤖 Generated with Claude Code

jnioche and others added 2 commits April 1, 2026 08:55
Wraps protocol.getProtocolOutput() in a Future with a configurable
hard timeout (fetcher.thread.timeout). When a fetch exceeds the
timeout the future is cancelled, the URL is marked as FETCH_ERROR,
and the thread moves on. Disabled by default (-1).

Fixes #996

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Julien Nioche <julien@digitalpebble.com>
@jnioche jnioche merged commit c179bae into main Apr 1, 2026
2 checks passed
@jnioche jnioche deleted the fetch-timeout-bolt branch April 1, 2026 18:12
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.

Blocking fetcher thread

2 participants