Repository navigation
plugin: give each thread its own temporary launcher file - #334
Open
Saksham Uboweja (SakshamUboweja) wants to merge 5 commits into
Open
Saksham Uboweja (SakshamUboweja) wants to merge 5 commits into
Saksham Uboweja (SakshamUboweja) wants to merge 5 commits into
Conversation
A Hermes gateway runs every session's hooks as threads of one process. The launcher's temporary file was named by the process alone, so sessions whose first prompts wrote bin/te and bin/te.json together shared one file: the first rename took it and the others failed, each failure a line in errors.log. Name it by the thread too, and replace through the store's Windows retry, since Windows refuses to replace a file another thread is reading or replacing.
…the race test survive a Windows retry
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.
test_gateway_and_cron_sessions_in_two_repositories_fold_apart_through_the_real_dispatcherfails now and then on Windows (main on Nov 20, runs 44647406663 and 44646610551; #333 today), each time with an errors.log line aboutte\bin\te.json.Cause. A Hermes gateway runs every session's hooks as threads of one process.
ensure_launchernamed its temporary file by the process id alone, so sessions whose first prompts wrotebin/teandbin/te.jsontogether shared one temporary file: the first rename took it and the others failed (FileNotFoundError). On Windows, two threads replacing the same launcher also collide (PermissionError).Fix (
plugin/paths.py)store._replace, the Windows retry the store already usesTest.
test_windows_launcher.pyholds four writers between write and rename, then lets them go: on main three of four fail, with the fix none do.Checked on Windows (fork CI, Python 3.13 / 3.10), four threads writing the launcher at once, 300 times:
The Hermes test itself, 100 runs each: main failed 4 / 2, this change 0 / 0. Linux passes before and after.