-
Notifications
You must be signed in to change notification settings - Fork 1.2k
CSS: out-of-memory/hang target:safari11 #4114
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
Comments
Expanding nested CSS is inherently exponential. Other CSS tools such as Lightning CSS and SASS do the same thing as esbuild given valid sufficiently-nested CSS, so it's not clear to me that esbuild is doing anything wrong here. Here are some examples of the expansion of your input in different tools (uses smaller input to avoid a crash/hang so you can see what's happening): Potential mitigations could be to try to apply limits to esbuild's implementation, such as nesting depth, execution time, or output length. But such limits could potentially inhibit valid use cases, so I'm not sure about this idea. How did this issue come up for you? Obviously it's possible to construct pathological nested CSS with big expansion factors, just like it's possible to create |
Thanks for the explanation! That makes sense to me
We noticed out-of-memory issues in our JS/CSS processing pipeline, so the above CSS snippet is part of a larger file - I just reduced it to the part that causes issues.
Oh ok I see. We use esbuild to process/minify JS/CSS on request (behind a CDN), so we're very interested in getting it safe to process random input. I'm happy to help with that! What I'm not sure about is that these issues started to appear with the update to v0.25 (for |
The following input causes esbuild to hang/consume a lot of memory (over 100 GB):
Command line:
esbuild --target=safari11 input.css
esbuild try target=safari11
For
--target=safari14
this issue started to appear with v0.25.0:esbuild try target=safari14
The text was updated successfully, but these errors were encountered: