GeezerVison is showing github.com — Add timeout for file watcher subscribe to address hangs on Rosetta x86 emulation by matthewijordan · Pull Request #5350 · anomalyco/opencode
Conversation
Summary
Minimal Reproduction Steps
Environment
- macOS with Apple Silicon (M1/M2/M3)
- Docker Desktop with Rosetta emulation enabled
- x86_64 Linux container running under Rosetta
Dockerfile
FROM --platform=linux/amd64 ubuntu:22.04
RUN apt-get update && apt-get install -y curl ca-certificates git && rm -rf /var/lib/apt/lists/*
RUN useradd -m -s /bin/bash testuser
RUN curl -fsSL https://opencode.ai/install | bash
RUN mv /root/.opencode/bin/opencode /usr/local/bin/opencode
RUN mkdir -p /work/repo && cd /work/repo && git init && echo '{"name":"test"}' > package.json && chown -R testuser:testuser /work/repo
WORKDIR /work/repo
USER testuser
CMD ["bash"]
Steps to Reproduce
# Build and start container
docker build --platform=linux/amd64 -t opencode-repro .
docker run --platform=linux/amd64 -d --name opencode-test opencode-repro sleep infinity
# Start opencode (first time - works)
docker exec -d opencode-test bash -c "opencode serve --port=4096 > /tmp/opencode.log 2>&1"
sleep 5
# Create a session
docker exec opencode-test curl -s -X POST http://localhost:4096/session -H 'Content-Type: application/json' -d '{}'
# Restart container
docker restart opencode-test
sleep 2
# Start opencode again (second time - HANGS)
docker exec -d opencode-test bash -c "opencode serve --port=4096 > /tmp/opencode.log 2>&1"
sleep 10
# This will timeout
docker exec opencode-test curl -s --max-time 10 http://localhost:4096/session
# Returns nothing - server is hung
Root Cause
@parcel/watcher's subscribe() function hangs under Rosetta x86_64 emulation. When inotify_init1() fails or behaves unexpectedly under Rosetta, the watcher's Backend::run blocks forever instead of propagating the error (see parcel-bundler/watcher#159).
This blocks the event loop, causing all subsequent async operations to hang - including file reads needed to load session data.
Verified
| Environment |
Result |
| Native ARM64 Ubuntu container |
✅ Works |
| x64 Ubuntu container under Rosetta |
❌ Hangs |
| x64 container with timeout fix |
✅ Works |
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
matthewijordan
changed the title
Add timeout for file watcher subscribe on Rosetta x86 emulation
Add timeout for file watcher subscribe to address hangs on Rosetta x86 emulation
Dec 10, 2025
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.