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: use version of htmlrewriter which does not make use of asyncify, which looks to have a potential memory leak under high load #2707

Closed
wants to merge 5 commits into from

Conversation

JakeChampion
Copy link
Contributor

Description

We noticed the memory issue with Netlify's CSP plugin which used the same htmlrewriter library. We've built a new htmlrewriter library which uses the latest version of lol-html and removes the ability to use async-handlers, which is what required asyncify to be included.

Documentation

This is intended to be a pure refactor and have no user visible changes, as such no documentation updates should be required

Tests

You can test this change yourself like so:

  1. deno test -A edge-runtime/

Relevant links (GitHub issues, etc.) or a picture of cute animal

https://deno.land/x/[email protected]

image

JakeChampion and others added 2 commits November 22, 2024 22:21
… which looks to have a potential memory leak under high load

we noticed the memory issue with Netlify's CSP plugin which used the same htmlrewriter library. We've built a new htmlrewriter library which uses the latest version of lol-html and removes the ability to use async-handlers, which is what required asyncify to be included.
@@ -1,5 +1,5 @@
import type { Context } from '@netlify/edge-functions'
import { HTMLRewriter } from '../vendor/deno.land/x/[email protected]/index.ts'
import { HTMLRewriter, init, type TextChunk } from 'https://deno.land/x/[email protected]/src/index.ts'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JakeChampion I'm not super familiar with this setup, but it looks like all our deno imports use a relative path and should be included in this file 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be covered by 4a359c6

@pieh pieh force-pushed the jake/htmlrewriter branch from 4a359c6 to b76dfb1 Compare December 9, 2024 15:45
@JakeChampion JakeChampion deleted the jake/htmlrewriter branch December 18, 2024 11:30
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.

3 participants