fix(rust): an update on a running server reloads the plugin #30
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/rust-plugin-reload"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found by the phase 18 walk (§34.3 step 5), in phase 18's own code.
The defect
The plugin was placed with
write_atomic, which removes the old file and then renames a.tmpover it. Oxide and Carbon watch the plugins directory and reload on a change. Both saw the remove as a delete and unloaded the bridge. Both ignored the rename, so the new file was never loaded. Everyupdate(or re-install) on a running server took the bridge down until the next boot, with no message. The move to v0.1.1 did exactly that on all three walk instances, on both frameworks:It also contradicted §34.2.3 ("both frameworks load a plugin the moment it lands, even on a running server").
The fix
The plugin is now overwritten in place (
fs::write). That's what an operator'scpdoes, and both frameworks reload on it; every hand-copy on the walk rig did.write_atomicstays forinstall.jsonand the configs, where atomicity is the point. A crash mid-write leaves a file that fails to compile;doctorreports it as not the deployed file, andupdatewrites it again.Also:
updateon the same bundle no longer ends with "nothing moved" right after putting back a hand-edited plugin, which is the remedydoctornames. It now says it put back what no longer matched.Proof
On the phase 18 rig, I hand-edited the plugin, then ran
update --game ruston a running Oxide server and a running Carbon server. In both cases the plugin was replaced, compiled, loaded, and reconnected to its own sidecar, anddoctorreported Everything checks out.cargo fmt,clippy -D warningsand 172 tests are green.🤖 Generated with Claude Code
https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
I added a second commit from the same walk step:
uninstall --game rust --server-id betaprinted "left the runicgateway account alone — this installer did not create it", but this installer had created it, during alpha's install. A Rust instance's service never owns the shared account; the last instance's removal decides that. So the action was right and the stated reason was wrong. It now reads "it is not this service's to remove", which is true for both games. Linux clippy and tests are green (166).Apart from that line, step 5's uninstall passed: beta's service and plugin were removed, its config, token and database were kept, and alpha and gamma kept running with
doctorclean.