Repository navigation
Closed
Labels
bugSomething isn't working
Description
Description
When you cancel a running Offsite sync job (s3_sync) from the Queue page, the job is marked cancelled, but the rclone sync process inside the container keeps running. It keeps sending data to the destination until it finishes on its own. The only way to stop it is to kill it by hand:
docker compose exec bbs pkill -f rcloneSeen with an "SSH host (SFTP)" destination.
Expected: cancelling stops the rclone transfer, as it already does for agent jobs, where the cancel is passed on to the agent.
Cause (from reading the v2.101.0 source):
- Cancel only updates the database.
QueueController::cancel()(src/Controllers/QueueController.php:409) andAdminApiController::cancelQueueJob()(src/Controllers/Api/AdminApiController.php:4622) only update thebackup_jobsrow, plus queue a break-lock for borg task types. Nothing signals the process running on the server. - The sync loop never checks for a cancel.
S3SyncService::runViaHelper()(src/Services/S3SyncService.php:549) startssudo bbs-ssh-helper rclone-transfer …withproc_openand callspump()without a timeout.pump()(:462) loops until the process exits and never re-reads the job status. - rclone is two
sudolayers away from PHP. The helper starts rclone withsudo -u <repo user> env … rclone sync, so rclone is a grandchild of the PHP process and runs as a different user.
Possible fix:
- Check for the cancel: in
pump(), which already wakes every 200 ms, check the job status every few seconds. When it'scancelled, stop the transfer and return. - Make sure the kill reaches rclone: terminating
$procalone probably won't, because rclone is behind twosudolayers and runs as another user. Some options:- have the helper
execrclone, or trap SIGTERM and pass it on; - start the transfer in its own process group and kill the whole group;
- add a helper subcommand, e.g.
bbs-ssh-helper rclone-cancel <user>, that kills that user's rclone.
- have the helper
- Possible side effect today: while an orphaned rclone is still writing, a new sync of the same repository could start and write to the same destination path.
Steps to Reproduce
- Set up Offsite Sync to an SFTP destination for a repository big enough that the sync takes a few minutes.
- Start the sync and wait until the queue shows rclone progress.
- Cancel the job from the Queue page (or through the API's
cancelQueueJob). - Run
docker compose exec bbs ps aux | grep rclone. rclone is still running, and the destination keeps receiving data.
Installation Type
Docker
BBS Version
2.101.0
Agent Version (if applicable)
No response
Agent OS (if applicable)
None
Relevant Logs
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
Cancelling an offsite sync or restore stops rclone (#577); agent uses…
marcpope commentedon Nov 17, 2026
Thanks @jandro, and for the write-up. The transfer loop now checks the job every two seconds and sends SIGTERM when it has been cancelled, with SIGKILL as a fallback after 15 seconds. bbs-ssh-helper runs rclone in the background and relays the signal through both sudo layers, so rclone gets it. The scheduler logs "stopped: job cancelled" and leaves the row alone. Offsite restores go through the same path.
Tested on my internal test server with a 7 GB SFTP upload: rclone and the helper were gone two seconds after the cancel. In the next release.