Skip to content

Conversation

@astralhpi
Copy link

Problem

Custom Socket polyfill implementation was causing memory leaks in Cloudflare Workers environments.

Solution

Removed custom net/tls polyfills since Cloudflare Workers now provide built-in polyfills for these modules.

Changes

  • Removed custom net/tls polyfill imports from Cloudflare build
  • Updated transpilation to use Cloudflare's built-in polyfills instead

Result

  • Fixes memory leak in Worker environments

Reproducer: https://github.com/astralhpi/cf-worker-memory-leak-sample

Cloudflare Workers now provide built-in net and tls polyfills,
making custom polyfills unnecessary and fixing memory leaks
caused by the previous Socket polyfill implementation.
@porsager porsager force-pushed the master branch 2 times, most recently from 4a0fe34 to 3a43815 Compare November 12, 2025 04:40
@porsager
Copy link
Owner

Fantastic ! Do you have any idea for running the tests for Cloudflare Workers too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants