Skip to content

Memtrace v1.0.9

Choose a tag to compare

@Alex793x Alex793x released this 10 Aug 14:12
· 3 commits to main since this release

Memtrace v1.0.9

The daemon stops working when there is nothing to do, and stop finishes the job

Fixed

  • Running Memtrace in one project no longer stops the database serving another. Starting anything — a session, an index, an editor's background server — swept up every storage server on the machine whose launching process had exited, on the reasoning that such a server belongs to nobody. That reasoning is wrong on macOS and Linux: a daemon started in the normal way outlives its launcher and is adopted by the system, which is what a healthy one looks like for the rest of its life. So each new invocation killed the storage server of every other project's running session, and the session it belonged to lost its database until something restarted it. Found by running two projects side by side on one machine. A server is now only collected when the scope is unambiguous — stopping the project it belongs to, or reclaiming a port that is genuinely needed — and never as a side effect of starting something. No indexed data was at risk; the affected sessions lost their connection, not their graph.
  • A store that has been indexed more than once no longer sends the daemon into a permanent rewrite. Attaching a vector to a symbol records a new copy each time, while the search graph keeps one entry per symbol — so a repository indexed twice holds two stored vectors per symbol and was read as having lost half of them. The response to apparent loss was to write every vector again, which added another copy per symbol and made the next reading worse, so the conclusion confirmed itself on every pass. In the field this ran at roughly three cores of continuous writing with no reads for hours on end, with the store growing the whole time. Apparent loss of that kind is now repaired by refilling the graph from the vectors already stored, which writes nothing; only genuine damage found while recovering triggers a rewrite.
  • Re-indexing a repository no longer leaves a second live copy of every vector behind. Attaching a vector to a symbol recorded a new copy and nothing ever removed the one it replaced, so a repository indexed twice held two live copies per symbol — measured on this release as 960 stored vectors against 480 symbols. That surplus is what the check above was reading as loss. A symbol's vector is now replaced rather than added to, and the new copy is written before the old one is dropped, so an interruption leaves a redundant copy the next pass clears rather than risking the only copy of a vector. The record log is append-only, so this does not shrink a store on disk; it stops the live count from multiplying, which is what drove the repeated re-indexing that grew one reported store to 3.6 GB. Copies written by an earlier version are left in place and are harmless.
  • Saving a file in a repository with a large number of ignored paths no longer stalls the watcher. Before deciding what changed, the watcher asks git which paths are ignored, and it sent the whole list before reading any of the answer. Past roughly sixty-four kilobytes of paths both sides were waiting for the other, so the check never returned and file watching stopped for that repository until the daemon was restarted. The two directions are now handled independently, with a timeout, and a batch of six thousand paths completes in well under a second.
  • Stopping now also reaps helpers that are not themselves Memtrace programs. This was named as a known limitation in 1.0.8: a stuck helper the daemon had spawned — a git process, for example — kept both itself and the daemon alive, and both had to be killed by hand. Stop now walks the owner's entire process tree, deepest first, and escalates until it is gone. It also finds that owner by inspecting running processes rather than by reading a file the dead process took with it, so an ownerless daemon is no longer invisible to it. Sessions belonging to other editors and agents are still left alone.
  • Blast radius on a symbol with very high fan-out now returns instead of running past any deadline. This was the other known limitation in 1.0.8: the walk read one symbol's edges to completion even once the answer was already capped. It now works to a time budget and returns what it found, marked incomplete, rather than not returning. MEMTRACE_IMPACT_WALK_BUDGET_MS raises or lowers the budget from its fifteen-second default.
  • The decision-memory handoff file no longer grows without bound. Captured sessions are appended to it and the background service records how far it has read, but nothing ever reclaimed the part already read — reported in the field at 2.53 GB with the service continuously working through it. The consumed portion is now dropped at startup, at the one moment no service is reading the file, and the unread remainder is preserved exactly.
  • Two Memtrace installations driving one store now say so. A globally installed copy and one built from source can be pointed at the same database, and the newer of the two writing under the older's assumptions is difficult to spot from the outside. Startup now records which installation claimed the store and warns when a different one attaches. An installation it cannot identify is never reported as a conflict.

Install

npm install -g memtrace