exo
exo copied to clipboard
[BUG] race condition on uninstall
Describe the bug
Uninstall fails to remove the var directory because the state file may be updated asynchronously by a background task during uninstall. Leaving behind a .lock file, which prevents the var directory from being removed.
To Reproduce
~/Projects/deref/exo (main) $ exo uninstall
destroying workspace: k6z3kyjcg1e885z1xzefhpzkk0
destroying workspace: 93d77y9771tzfw8bt8gfs05xjm
destroying workspace: 9vhb0tfazdfmcfw6eb67d3esr8
removing home directory: /Users/brandonbloom/.exo
Error: removing exo directory: unlinkat /Users/brandonbloom/.exo/var: directory not empty
removing exo directory: unlinkat /Users/brandonbloom/.exo/var: directory not empty
~/Projects/deref/exo (main) $ ls /Users/brandonbloom/.exo/var
state.json.lock
Expected behavior
All async tasks should be stopped before uninstall proceeds, so this should be impossible.
More generally, there are some issues with shutdown paths. exo exit shuts down the daemon, but doesn't stop supervised processes. Is that OK? Meanwhile, exo workspace destroy does stop processes, but potentially fails & then there is no obvious way to cleanup. More thought & various improvements are needed.