Repository navigation
Embedder health from a real embedding, update beside a running serve, and the procprotect test that could not exit (TEN-555, TEN-556, TEN-557) - #93
Merged
Conversation
… the process could then not exit (TEN-557) On CI's Windows runner the procprotect test binary printed PASS and then sat, saying nothing, until go test killed it 22 minutes later (run 45771970023, the Windows job of PR 89). TestNowReadsTheStateAgain started a thread and ended it with TerminateThread about 10 ms later. A thread that has just started is still inside ntdll: it holds the loader's lock and takes memory from the process heap. Ended in that moment it leaves those locked for good, and the process can then start no thread, load no library and not exit: ExitProcess waits for the same locks. On an idle machine the thread is long past its start by then; on a busy one it is not always. Held to two processors with one of them kept busy, the test binary as it was did this in 3 runs of 22: PASS, and still there 20 seconds later. - The threads these tests end are created suspended and never resumed (neverRuns): a thread that never ran holds nothing. The victim that ends one of its own threads had the same fault. - After the tests, TestMain says on stderr which step it is in, gives the clean-up a minute, and on Windows ends the process with TerminateProcess and not ExitProcess, so that nothing a test did to its own process can keep the binary from ending. - TestAProtectedProcessExitsByItself: a protected process whose main returns exits the ordinary way. The test binary's own exit no longer shows that, so it is a test of its own. Nothing in Tenant changes: Protect is not the cause (a program that never calls it hangs the same way), and Tenant calls TerminateThread nowhere. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
docs/ARCHITECTURE.md is main's here; its generated facts are regenerated in a later commit, once the branch's other changes are in. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
…hen the embedder stops answering (TEN-555) The two things PR 89 left open on TEN-555. The launch line "embeddings OK" came from the embedder's model list, which an embedder stuck on a request still answers: on the R340 it said OK while no embedding had come back for hours. Tenant now asks for one small embedding beside start-up and says what happened: "embeddings OK" with how long it took, "embeddings SLOW" over 5 seconds, "EMBEDDINGS NOT ANSWERING" after 30. Start-up does not wait for it. The same question is put every five minutes while serve or the TUI runs. An embedder that has given no embedding for five minutes is system 3110 (an error, written again every 30 minutes while it lasts), and the new built-in alert rule embedder-silent fires on it; system 1110 says when it answers again. Asking keeps the embedding model loaded while Tenant runs. tenant doctor's two embedding checks get the same 30-second limit: they waited for ever on such an embedder. Checked against a real serve and a model server whose embeddings never come back, come back, and come back after 7 seconds. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
…at restarts nothing says what to restart (TEN-556)
On the R340, where two scheduled tasks of the operator's own start Tenant,
`tenant update` failed at its backup while serve ran, and with serve
stopped it swapped the binary and restarted nothing.
The backup: a master holds fleet.holder.lock for as long as it runs,
Windows does not let another process read a locked file, and the walk
stopped there ("another process has locked a portion of the file").
`tenant backup create` beside a running master failed the same way. Empty
lock files are now left out: they hold nothing and are made again. A lock
file with something in it (a package manager's, in a work folder) is kept.
The restart: `tenant update` restarts the unit `tenant service` installed
and knew of nothing else. With no such unit it now lists the processes
that run the old binary and, on Windows, the scheduled tasks whose action
names it, with their arguments and the two commands that restart a task.
It restarts none of them itself: ending a task is a hard stop.
The refusal on a development build names the running build and
`tenant update --force [--version vX.Y.Z]`.
Checked for real on Windows: a backup beside a running serve with the
fleet lock held succeeds, and the same binary without the fix fails with
the R340's error; the task scan was run over this machine's task list.
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
…service manager's runner (TEN-556) CI's macOS job failed TestProcessesOfFindsAnotherProcessOfTheSameBinary: the list came back empty. Where there is no /proc, processesOf asked ps through runCmd. runCmd is the way to the service manager, and the test binary closes it so that no test rewrites this machine's own service; ps was refused with it. Outside the tests the call worked. ps is now run directly: a list of processes changes nothing. Each column has its own -o, which every ps reads the same way. ps names a process by what it was started as. A process started by a bare name (`tenant serve` typed in a shell) was not matched to the binary; its name is now looked up on PATH. TestProcessesByPS runs that path on Linux too, where ps gives bare names. With the old call it fails there as it did on CI's Mac. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
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.
Three tickets, one commit each, plus a merge of main and the docfacts refresh.
TEN-557: the procprotect test binary that sat 22 minutes after
PASSTest files only;
Protectitself is unchanged.TestNowReadsTheStateAgaincalledTerminateThreadon a thread about 10 ms afterCreateThread. A thread ended while it is still starting inside ntdll leaves the loader's lock and the process heap's lock held for good, and the process can then start no thread, load no library and not exit.TerminateProcess, and its clean-up has a one-minute limit and says on stderr which step it is in, so a hang would now name itself.PASSin 5 of 25 runs. With only the suspended threads: 400 of 400 exited. With the whole fix: 400 of 400.TEN-555: "embeddings OK" from a real embedding
/v1/modelsand called that "OK". A server that takes connections and returns no embedding passed.serveand the terminal UI now ask for a real embedding at start and every five minutes, and sayembeddings OK,embeddings SLOWorEMBEDDINGS NOT ANSWERINGwith the reason.embedder-silent.tenant doctorgives the embedder 30 seconds and then fails with what to restart, where it used to wait for ever.serveand a fake model server that hangs, answers, or answers slowly.TEN-556:
tenant updatebeside a running serve*.lockfiles are now left out of a backup; a non-empty one (ayarn.lockin a work folder) is kept.tenant serviceinstalled nothing, now lists the processes still running the old version and, on Windows, the scheduled tasks that start this binary, with the commands to restart each. It restarts none of them itself.tenant update --force).serve. Not checked on macOS.Checks
Local mirror on
9147205: build and vet for windows, linux and darwin; gofmt;go generatewith no drift; smoke eval;go test -timeout 20m -p 3 ./...(96 packages ok, 0 failed); docfacts current. Linux-raceunder WSL forinternal/backup,internal/logs/alerts,internal/config,internal/procprotectandcmd/tenant: ok. gitleaks and govulncheck were not run locally.Documentation
CHANGELOG.md,docs/EVENTS.md,docs/LOGGING.md,docs/ARCHITECTURE.mdanddocs/serve-runbook.mdare in this pull request. The public pages (first-launch/doctor.md,dashboard/logs.md,setup/requirements.md,setup/update.md,setup/backup.md) are written on a findtime-net branch that is not pushed yet: its HTML still has to be built. That pull request follows and merges when this one does.🤖 Generated with Claude Code