Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix local worker runtime freezing #1819

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/quiet-masks-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/cli-hydrogen': patch
---

Fix an issue where the local worker runtime could freeze after a number of requests.
10 changes: 9 additions & 1 deletion packages/cli/src/lib/mini-oxygen/workerd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,16 @@ export async function startWorkerdServer({
log: new NoOpLog(),
liveReload: watch,
host: 'localhost',
handleRuntimeStdio() {
handleRuntimeStdio(stdout, stderr) {
// TODO: handle runtime stdio and remove inspector logs
// stdout.pipe(process.stdout);
// stderr.pipe(process.stderr);

// Destroy these streams to prevent memory leaks
// until we start piping them to the terminal.
// https://github.com/Shopify/hydrogen/issues/1720
stdout.destroy();
stderr.destroy();
},
workers: [
{
Expand Down
8 changes: 8 additions & 0 deletions packages/cli/src/lib/vite/mini-oxygen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ export async function startMiniOxygenRuntime({
inspectorPort: privateInspectorPort,
handleRuntimeStdio(stdout, stderr) {
// TODO: handle runtime stdio and remove inspector logs
// stdout.pipe(process.stdout);
// stderr.pipe(process.stderr);

// Destroy these streams to prevent memory leaks
// until we start piping them to the terminal.
// https://github.com/Shopify/hydrogen/issues/1720
stdout.destroy();
stderr.destroy();
},
workers: [
{
Expand Down
Loading