fix: ensure tab-groups data dir exists before acquiring lock file#11
Open
grigoryosifov wants to merge 1 commit into
Open
fix: ensure tab-groups data dir exists before acquiring lock file#11grigoryosifov wants to merge 1 commit into
grigoryosifov wants to merge 1 commit into
Conversation
When a user invokes any stateful browser_tab_group / browser_tabs call before
~/.ultimate-playwright-mcp/ has been created (fresh machine or wiped data dir),
acquireLock() calls writeFileSync(LOCK_PATH, ..., { flag: 'wx' }) which fails
with ENOENT because the parent directory is missing. The outer catch then tries
readFileSync(LOCK_PATH, ...) which also fails with ENOENT, the loop retries,
and depending on host filesystem behavior either takes until maxWaitMs to give
up or appears to hang indefinitely. From a user's perspective: the first tool
call freezes.
Fix: call ensureDir() at the top of acquireLock(), same as readRegistry() and
writeRegistry() already do.
Credit to @moltenrooster (Joe Lemay) for identifying the root cause while
setting up ultimate-playwright-mcp on a machine with no prior data dir.
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.
Problem
When a user invokes any stateful
browser_tab_group/browser_tabscall before~/.ultimate-playwright-mcp/has been created (fresh machine or wiped data dir),acquireLock()calls:```ts
writeFileSync(LOCK_PATH, String(process.pid), { flag: "wx" });
```
which fails with
ENOENTbecause the parent directory is missing. The outer catch then triesreadFileSync(LOCK_PATH, ...)which also fails withENOENT, the loop retries, and depending on host filesystem behavior either takes untilmaxWaitMsto give up or — in practice on some macOS setups — appears to hang indefinitely under load. From a user's perspective: the first stateful tool call freezes.Reproducer
rm -rf ~/.ultimate-playwright-mcp/browser_tab_groupaction=list(or any action that hits the registry)Fix
Call
ensureDir()at the top ofacquireLock(), exactly asreadRegistry()andwriteRegistry()already do. One-line addition.Tested
~/.ultimate-playwright-mcp/on a test macOS machine (Chrome 147, macOS 26.2 ARM64)browser_tab_group action=listhung;browser_tabs action=listhung similarly