Repository navigation
Refuse project caches that a running process uses - #32
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plonge treats a project as quiet when its HEAD log and newest agent transcript are old, but a long-running service, such as a systemd unit that runs
.venv/bin/python, updates neither.cleancould then delete the.venvwhile the service runs, and the service's next restart fails.This adds
internal/procs, which takes one snapshot of the running processes: on macOS, onelsof -w -n -P +c 0 -F pcLfncall and oneps -axww -o pid=,user=,args=call; on Linux, a read of/proc/<pid>/(exe,cwd,root,fd,maps,cmdline,comm). A process uses a cache when it has a file open or a library mapped under it, works in it, runs an executable from it, or names a path in it on its command line. The command line is needed because a venv'sbin/pythonis a symlink to the base interpreter, so the executable thatlsofor/procreports is outside the.venv.engine.Inspecttakes the snapshot after the agent check, andscan.RefuseUsedmoves each used candidate torefusedbefore measuring, soscanand the dry run show it;--include-activedoes not override it.clean --applychecks again before each deletion through a newclean.Options.InUse, with a fresh snapshot before the first deletion and again only when the last one is more than 10 seconds old. A refusal readsRefused ~/code/app/.venv: in use by python3.12 (PID 4312), whose command line names bin/python, and the JSON refusal gains aprocessesarray. Global rules are unchanged.If the snapshot fails (
lsoforpsmissing, failing, or slower than 30 seconds, or/procunreadable), a newprocessesactivity source fails and every project counts as busy; a failed re-check skips the cache. This fails closed, like a failingpaseo ls, because a missing tool does not show that no process uses a cache. "Not selected, busy project (Paseo)" becomes "Not selected, busy project".Limits, which the README and
docs/rules.mdstate: a service that is stopped at scan time, a timer or cron job, and a process that starts after the last check are not seen; neither is a process that names no cache path and holds nothing open there, such aspythonfrom an activated venv. Without root, another user's process is seen only through its command line, and on macOSpsjoins words with spaces, so a path with a space can be missed.This branch is based on
main, not stacked on #30. After this merges, #30 can build its open-file list from aprocssnapshot and droplistOpenFiles. This branch conflicts with #29 ininternal/engine/engine.go, where both add to theclean.Optionsliteral.Departures from the design:
lsofgets+c 0because its default cuts command names to 9 characters (python3.1); the fail-closed test is inscanrather thanengine, becausescan.RefuseUsedhandles the failure andenginehas no tests; and acmd/plongetest starts a realsleepin a cache, so the tests now run the system'slsofandpson macOS.Closes #31