cloudflare / miniflare

🔥 Fully-local simulator for Cloudflare Workers. For the latest version, see https://github.com/cloudflare/workers-sdk/tree/main/packages/miniflare.
https://miniflare.dev
MIT License
3.78k stars 205 forks source link

[Miniflare 3] Fix `Miniflare#dispose()` immediately after `new Miniflare()` #705

Closed mrbbot closed 1 year ago

mrbbot commented 1 year ago

We previously waited for Miniflare to be ready before dispose()ing. Unfortunately, we weren't waiting for the workerd config to finish being written to stdin. Calling dispose() immediately after new Miniflare() would stop waiting for socket ports to be reported, and kill the workerd process while data was still being written. This threw an unhandled EPIPE error.

This changes makes sure we don't report that Miniflare is ready until after the config is fully-written.

Closes cloudflare/workers-sdk#4363

changeset-bot[bot] commented 1 year ago

⚠️ No Changeset found

Latest commit: 901671afd837db5fdc434b7232770bbd36affd71

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

[Click here if you're a maintainer who wants to add a changeset to this PR](https://github.com/cloudflare/miniflare/new/bcoll/fix-tre-sync-dispose?filename=.changeset/mighty-kangaroos-reply.md&value=---%0A%22%40fake-scope%2Ffake-pkg%22%3A%20patch%0A---%0A%0A%5BMiniflare%203%5D%20Fix%20%60Miniflare%23dispose()%60%20immediately%20after%20%60new%20Miniflare()%60%0A)