Skip to content

Cancel the rest of the rip queue when the disk is full (#2190) - #2204

Open
srijan-2 wants to merge 1 commit into
RipMeApp:mainfrom
srijan-2:fix/2190-cancel-all-on-enospc
Open

srijan-2 wants to merge 1 commit into
RipMeApp:mainfrom
srijan-2:fix/2190-cancel-all-on-enospc

Conversation

@srijan-2

Copy link
Copy Markdown

Category

This change is exactly one of the following (please change [ ] to [x]) to indicate which:

Description

Fixes #2190. When a download fails because the device is out of disk space (ENOSPC), RipMe used to just log an error for that one file and move on — the rest of the current album, and every other album still queued, would keep trying to download and keep hitting the same out-of-space error. This change makes an ENOSPC error cancel the rest of the current album immediately and stop the rest of the queue, in both the GUI and the CLI batch modes (-r, -R, -f).

Design:

  • New com.rarchives.ripme.utils.RipStatus — a tiny, dependency-free holder for a single process-wide "cancel everything" flag (requestPanicAll() / consumePanicAll()). It deliberately does not live on MainWindow: MainWindow has several static Swing field initializers (e.g. new JLabel()), so merely referencing that class from code that might run headless (CLI batch mode has no MainWindow instance at all) risks a HeadlessException with no display attached. RipStatus has no such baggage, so DownloadFileThread can signal a cancellation regardless of whether a GUI exists.
  • DownloadFileThread — in the existing ENOSPC catch branch, now calls observer.panic() (stops the rest of the current album — this mechanism already existed but wasn't being used here) and RipStatus.requestPanicAll() (signals that the rest of the queue should stop too).
  • MainWindow#ripNextAlbum() — added a check for RipStatus.consumePanicAll() alongside the existing wasGracefulStop/wasPanicStop check, so the GUI's queue loop stops pulling the next album once a disk-full panic has been requested.
  • App#handleArguments() — added the same stop-check-and-break to the three CLI batch loops that had no abort mechanism at all before this: -r (re-rip all), -R (re-rip selected), and -f (urls-file).

A pre-existing bug I found but did not fix here: in ripNextAlbum():

boolean wasGracefulStop = gracefulStop.getAndSet(false);
boolean wasPanicStop = gracefulStop.getAndSet(false); // reads gracefulStop again, not panicStop

wasPanicStop reads gracefulStop a second time instead of panicStop.getAndSet(false) — looks like a copy/paste slip. I left it as-is and added an independent, correctly-wired check instead, so this PR doesn't depend on that line being right and doesn't change panic-button behavior that's outside this issue's scope. Flagging it here in case it's worth a follow-up issue.

Testing

Required verification:

  • I've verified that there are no regressions in gradlew test (there are no new failures or errors).
  • I've verified that this change works as intended.
    • Downloads all relevant content.
    • Downloads content from multiple pages (as necessary or appropriate).
    • Saves content at reasonable file names (e.g. page titles or content IDs) to help easily browse downloaded content.
  • I've verified that this change did not break existing functionality (especially in the Ripper I modified).

Optional but recommended:

  • I've added a unit test to cover my change.

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.

Cancel all queued rips when disk runs out of space (ENOSPC)

1 participant