Skip to content

Run libgit2 calls in a TFWorker - #126

Open
guillep wants to merge 2 commits into
pharo-vcs:Pharo15from
guillep:lgit-worker-runner
Open

guillep wants to merge 2 commits into
pharo-vcs:Pharo15from
guillep:lgit-worker-runner

Conversation

@guillep

@guillep guillep commented Oct 30, 2026

Copy link
Copy Markdown
Member

This PR makes LGitLibrary run its calls in a TFWorker, so long libgit2 operations no longer block the VM.

Goal

With the same-thread runner, git_remote_fetch and clone block the whole VM: no process runs, and a progress bar cannot repaint. With a worker, the image stays responsive. Iceberg needs this to fetch and clone in the background and show progress.

Main changes

  • Added LGitLibrary>>runner, answering TFWorker default.

Depends on #125, which binds callbacks to LGitLibrary. Without it, libgit2 calls them from the worker with the same-thread runner and crashes the VM. After changing the runner of a live image, FFIMethodRegistry resetAll is needed, because compiled callouts cache it.

Measurements

mutalk clone from GitHub on macOS: 1.5 s on the same-thread runner, 7–10 s on the worker with Iceberg's current per-callback progress work, 3.1–3.5 s on the worker with a callback that does nothing, and 1.1–1.3 s on the worker with throttled progress (two runs). allBranches × 300 took 239 ms on the same-thread runner and 593 ms on the worker, so small calls are about 2.5× slower.

Known limitations

Not tested on Windows or Linux, nor in a headless image. A failing error read could still be overwritten if two processes alternate calls, and the full Iceberg-Tests package has not completed on the worker. One IceGitMergeTest test timed out once.

🤖 Generated with Claude Code

guillep and others added 2 commits October 30, 2026 14:21
Callbacks fell back to the default library and its same-thread runner. If LGitLibrary used a TFWorker, libgit2 called them from the worker thread and crashed the VM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
libgit2 calls such as fetch and clone block the VM on the same-thread runner, so the image cannot even repaint a progress bar. Needs the callbacks bound to LGitLibrary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant