Skip to content

-E time limit does not stop the mirror under a slow server#482

Merged
xroche merged 1 commit into
masterfrom
fix-maxtime-hardstop
Jul 4, 2026
Merged

-E time limit does not stop the mirror under a slow server#482
xroche merged 1 commit into
masterfrom
fix-maxtime-hardstop

Conversation

@xroche

@xroche xroche commented Jul 4, 2026

Copy link
Copy Markdown
Owner

A capped pre-release crawl of a bot-throttled site never stopped: -E300 ran 8m50s and only ended on an external SIGINT (#481). The deadline was checked at per-link boundaries alone, so slow transfers starved it for minutes, and the smooth stop it eventually requested let the remaining transfers drain at server pace with no bound.

back_wait() now checks the deadline on every cycle. Once a grace period expires (maxtime/10, clamped to 5..30s), it aborts the in-flight HTTP transfers the same way the -T timeout path does; FTP slots stay with their owning thread. back_checkmirror()'s previously dead 0 return carries the hard stop, so the existing caller branches engage. The new 34_local-maxtime.test crawls a trickling local server with -E2: the fixed engine stops in about 8 seconds, the unfixed binary runs 118s, fails both log assertions, and leaves a .delayed file behind.

The test skips local-crawl.sh's .delayed leftover audit: a cancelled crawl can orphan a placeholder through a window in hts_wait_delayed() that predates this PR, tracked as #483.

Closes #481

-E was only evaluated at per-link boundaries, so a slow or throttling
server starved the check for minutes, and the smooth stop it finally
requested drained the remaining transfers at server pace with no bound.
back_wait now checks the deadline every cycle and, once a short grace
period expires, aborts the in-flight HTTP transfers like the -T timeout
path does (FTP slots stay with their owning thread). back_checkmirror's
0 return, previously dead, now carries the hard stop.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
@xroche xroche force-pushed the fix-maxtime-hardstop branch from 4cab0be to d14a988 Compare July 4, 2026 10:58
@xroche xroche merged commit dfafe28 into master Jul 4, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-E time limit can fire minutes late and never hard-stops the mirror

1 participant