[Bug] Site Recovery - Test Failvoer, Planned Failover and Emergency Failover does not work
Hey there! 👋 Thanks for taking the time to report this bug — we appreciate it!
Please keep in mind: PegaProx is developed and maintained entirely by volunteers in our free time. We do our best, but we can't work magic 🪄 — please be patient, we'll get to your issue as soon as we can.
Want to help keep PegaProx alive?
- ⭐ Star the project — it's free and helps a lot!
- 💖 Become a Sponsor — helps us dedicate more time to development
- 🤝 Contributing code or docs is always welcome too!
Describe the bug
Similar issue to: [Bug] site recovery planned failover seems to not work #225
Steps to Reproduce
- Click Test Failover, Planned failover or Emergency Failover
- A task is added to "Failover History" under the site recovery pair, but nothing happens on the cluster or nodes
Expected behavior
Should initiate failover of the vm, as the replication job is running normally, as per schedule
Environment
- PegaProx Version:0.9.10.2
- Installation Method:LXC
- OS:Debian 13
- Browser:Firefox 150
- Behind Reverse Proxy? No
- UI? Modern
Logs
Screenshots
Readiness check:
DR DRILL:
TEST FAILOVER:
PLANNED FAILOVER AND EMERGENCY FAILOVER:
Checklist
- [ ] I have searched existing issues to make sure this is not a duplicate
- [ ] I am using the latest version of PegaProx
Hey @blackshocks — thanks for filing fresh and for the cross-reference to #225. That ticket was closed in early April but your comment on it 3h ago + this new report make it clear the regression is back. Tagging @MrMasterbay because Site Recovery failover touches the replication state machine, cluster API auth, and the failover background worker all at once — Nico's territory, not something I'd want to hot-patch.
What would help triage: browser DevTools network tab response when you click any of the three failover buttons (status code + response body), plus /app/logs/ server log around that timestamp. The stuck-task-after-reboot pattern you described on #225 suggests the worker thread may not be reaching the actual failover code at all — log would tell us if it's hitting the API but exiting early, or never being invoked.
Sponsoring keeps the lab boxes humming — opencollective.com/pegaprox.
— Marcus
got a 409 response upon clcking Planned Failover button:
Got the bundle @blackshocks, thanks — pulling it down for review. Site Recovery internals (replication state machine + failover worker + cluster API auth) sit on @MrMasterbay's plate so the actual diagnosis will run through him; I'll make sure the bundle lands in his queue.
If the previous failover task is still showing as "running" after a server restart, that's the stuck-state bug we saw on #225 — there's a startup cleanup that's supposed to reset those plans to failed on boot, would be useful to know whether you see that runs in the server logs around restart time.
Tip in the OC jar — opencollective.com/pegaprox — covers the disk space for these support-bundle archives, much appreciated.
— Marcus
after host reboot, tasks are still visible. Which is the log file to verify?
@blackshocks — main app log lives at logs/pegaprox.log (or /var/log/pegaprox.log on a packaged install) — that's where the failover orchestrator writes via the pegaprox.site_recovery logger. grep site_recovery logs/pegaprox.log is the fastest sieve. Per-cluster API chatter goes into logs/<cluster_id>.log — the cluster ID matches what's in the URL when you've got the cluster open in the UI.
The "tasks still visible after reboot" symptom is Site-Recovery-state-machine territory — that's @MrMasterbay's lane and he's on holiday until May 18, so the actual analysis is going to wait for him.
Fresh log slice from after the reboot would help if you've got one — attach it here and it'll be in the queue with the previous bundle.
Tip jar's https://opencollective.com/pegaprox if support ever gets to a point where it earns its keep for you.
— MK
using lxc appliance, unable to find the required file. is there somewhere else we need to verify?
@blackshocks — ah, LXC appliance. Install root is /opt/PegaProx/, so the log is at /opt/PegaProx/logs/pegaprox.log. If that path is empty or missing, the systemd unit writes to journald instead — journalctl -u pegaprox --since today | grep -i site_recovery pulls the failover-orchestrator lines from there.
Easiest path if you want to skip all of that: Settings → Support Bundle in the UI generates a zip with the redacted log slice + DB state pre-cooked. Drop that here and it'll have everything @MrMasterbay needs when he's back.
Donations at https://opencollective.com/pegaprox if support gets to where it earns its keep — no pressure either way.
— MK
Update — pulled your support bundle this morning and worked through it. Fix landed on Testing as commit 2cdd22f.
Root cause: the Site Recovery code path has no boot-time cleanup. When PegaProx crashed/restarted mid-failover (which is what happened to you), the in-flight rows in the DB stayed exactly where they were:
site_recovery_eventsrow that wasstatus='running'at start-of-failover — never got theUPDATEto'completed'/'failed'because the process died. Stays pinned.site_recovery_plans.statuswas at'running'/'testing'— same trap.
The UI reads those rows directly and renders them as live tasks, which is exactly what you saw after the host reboot.
Fix: new recover_orphan_runs() sweep that runs once at startup, before the heartbeat loop spawns:
- Any
site_recovery_eventsrow withstatus='running' AND completed_at IS NULL→ flipped to'aborted'withcompleted_at=nowand a{"reason": "pegaprox_restart"}details JSON so it's clear in the audit feed why the row changed. - Any
site_recovery_plansrow atstatus='running'/'testing'→ flipped to'failed'. You can then reset it to'ready'via the existing reset endpoint and re-run the failover. - Audit-log entry
site_recovery.boot_cleanuprecords what happened with counts.
Verified live: synthetic test against the dev DB — injected 3 events (2 running + 1 completed) and 3 plans (1 running + 1 testing + 1 ready), called the recovery function. 2 running events → aborted (with the details JSON populated), completed event left alone, 2 running/testing plans → failed, ready plan left alone. 8/8 cases. Synthetic rows cleaned up afterward; dev DB back to pristine.
One thing I noticed in your bundle that's a separate gap, not the failover bug: pegaprox.log was reported "Log file not found" at all 4 paths the bundle code probes. That's because PegaProx writes to journald by default and only writes a file in some installs — the support bundle should fall back to a journalctl -u pegaprox slice when no file exists. Filing that as a follow-up; doesn't block this fix.
When the next release ships, the next time the service restarts (planned or otherwise) the stuck rows will auto-clean.
Donations at https://opencollective.com/pegaprox keep the support-bundle-deep-dive workflow viable — appreciated if it earns its keep for you.
— Marcus
Thx. I assume the scheduled fix just resolves the tasks which are apparently "running"? Does it also fix the Failover functionality?
@blackshocks — fair question, glad you flagged it.
The fix on Testing addresses ONLY the stuck-row symptom: rows in site_recovery_events with status='running' that never got their completed_at update because the previous PegaProx process died mid-task → at next boot those get flipped to 'aborted', and the matching site_recovery_plans rows go from running/testing back to failed so the state machine can be re-armed.
What it does NOT fix: the underlying reason your Test Failover / Planned Failover / Emergency Failover didn't complete in the first place. That's a separate question — could be the state machine itself, the replication-state side, the cluster API auth, or PVE-side. Your support bundle is the starting point and that deeper diagnosis goes to @MrMasterbay who's back today; he owns the Site Recovery state machine.
If you have a fresh log slice from a failover attempt AFTER the fix lands on a release, that's the most useful next piece of data. Until then, the boot-recovery at least stops the UI from showing aborted-since-reboot tasks as still running.
Donations at https://opencollective.com/pegaprox keep the multi-layer-failure debug work going — appreciated if any of this earns its keep.
— Marcus
Right, will wait for this fix to land. Will then delete the cross-cluster replication, site recovery pairing and configure from scratch. If there are still issues, will upload the support bundle.
@blackshocks — v0.9.10.3 shipped: https://github.com/PegaProx/project-pegaprox/releases/tag/v0.9.10.3
The boot-recovery sweep is included. After the upgrade, any leftover stuck-running tasks from previous failover attempts auto-abort at service start, and the UI should stop showing aborted runs as live.
Leaving this ticket OPEN — the underlying "Test / Planned / Emergency Failover doesn't actually work" you raised on Sunday is the bigger question and isn't addressed by v0.9.10.3. We need a fresh log slice from a failover attempt AFTER the upgrade (boot-recovery at least ensures the state machine starts clean). Once you have one, attach it here and we'll dig in.
Donations at https://opencollective.com/pegaprox if multi-layer-failure debug work earns its keep.
— Marcus
Have updated, tested as per below:
-
Removed site pairing, created new cross-cluster replication task for vm01 (vmid 100) which concluded successfully. Created site recovery pair, mapped network and storage, ran readiness without errors, but Test Failover, Planned Failover and Emergency Failover donot initiate any task in Proxmox at all.
-
Tried the same thing, but did not create a prior cross-cluster replication job, same results.
Bundle attached.
Thanks for the quick turnaround @blackshocks. Good news on the boot-recovery side: only 1 row in site_recovery_events in your new bundle (down from 10 in the 2026-05-14 one), confirming the v0.9.10.3 fix is doing its job — stuck-running rows from previous runs got cleaned at boot.
Bad news on the diagnosis side: your new bundle's pegaprox.log came back with only the journalctl permission hint:
Users in groups 'adm', 'systemd-journal' can see all messages.
No journal files were opened due to insufficient permissions.
That's a bug in my v0.9.10.3 journalctl-fallback fix — I didn't account for the case where the pegaprox service user isn't in the systemd-journal group, so the fallback fires but only grabs the permission hint instead of real log content. So I have zero PegaProx-side trace to look at for your "failover initiates no task" symptom.
Two ways to unblock the next diagnostic round:
(1) Add pegaprox to the journal group on your host, then re-generate the bundle:
sudo usermod -a -G systemd-journal pegaprox
sudo systemctl restart pegaprox
# (trigger the failover so it logs)
# (then re-generate the bundle)
(2) OR run journalctl directly as root and paste the relevant slice here:
sudo journalctl -u pegaprox --since "1 hour ago" | grep -iE 'site_recovery|failover|recovery' | tail -100
(Option 2 is faster if you just want to send the log slice without re-rolling the bundle.)
The journalctl-permission detection itself is fixed on Testing as 32943a4 — the next release will tell you "your pegaprox user is missing journal group access" directly in the bundle instead of just silently shipping the hint text. Filed deploy.sh should add pegaprox to systemd-journal group on fresh installs as a separate cleanup item.
On the "failover initiates no task" symptom itself — once we have actual logs I can trace whether the _create_event step is even firing, or whether the orchestrator is bailing earlier (auth, target-cluster lookup, replication-state check). The pattern you describe (event row gets created, but no PVE qm-migrate or qmtunnel task) most likely points at the orchestrator failing somewhere between _create_event and the PVE API call — but I need the log to say where.
Donations at https://opencollective.com/pegaprox if multi-bundle debug rounds earn their keep.
— Marcus
do we firstly need to create pegaprox user on the host? See below:
Wiped out and re-created the 2 clusters from scratch, as well as installed PegaProx on a Debian 13.x vm. Created replica job for source vm on cluster cl1 to cl2. Ran the job, and it wiped out an existing vm (id 101) on the on cluster cl2 (this was definitely not supposed to be happen). Logs attached for review - have not yet done the DR Tests, as I assume this needs to be looked at first, due to the risk of potential destruction of data (not sure if it is how we setup our side or there really is a bug that wipes out destination vm that has same id as source).