sveltekit-superforms icon indicating copy to clipboard operation
sveltekit-superforms copied to clipboard

`svelte-check` runs out of memory after upgrading from 2.27.1 to 2.27.2+

Open piolet opened this issue 3 weeks ago • 4 comments

Describe the bug

When upgrading @superforms/svelte from 2.27.1 to 2.27.2 (and also tested on 2.28.1), running svelte-check causes Node to run out of memory and crash. Reverting back to 2.27.1 fixes the issue immediately.

This happens consistently in a multi-package pnpm workspace, but only in the app that imports and uses Superforms.

To Reproduce

  1. Have a SvelteKit project using Superforms 2.27.1.
  2. Run:
    svelte-check --tsconfig ./tsconfig.json
    
    → works normally.
  3. Upgrade to 2.27.2 or later (tested 2.28.1).
  4. Run the same command.
  5. The process runs indefinitely and eventually crashes due to memory exhaustion.

Actual Behavior

svelte-check consumes memory until Node crashes:

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Abort trap: 6
Exit status 134 (interrupted by signal 6: SIGABRT)

Excerpt of the stack trace:

Mark-Compact 4027.6 (4129.0) -> 4012.0 (4129.5) MB
allocation failure; scavenge might not succeed

Expected Behavior

svelte-check should run normally, as it does in version 2.27.1.

Environment

Item Version
@superforms/svelte 2.27.1 ✅ works
2.27.2 ❌ OOM crash
2.28.1 ❌ OOM crash
Node 20.x (macOS)
Package manager pnpm (workspaces)
SvelteKit latest stable
svelte-check run via workspace script

Additional Notes

  • No configuration or code changes aside from updating Superforms.
  • No changes in tsconfig.json, svelte.config.js, or project structure.
  • This suggests the update increases generated/inferred TypeScript type complexity, leading to excessive memory usage by svelte-check.

Can Provide Reproduction

I can provide a minimal reproducible repository if needed — just let me know.


Thanks a lot for your work on Superforms ❤️ It's a fantastic library!

piolet avatar Nov 07 '25 12:11 piolet

Hello, thank you, I haven't seen this error locally or in any CI builds, so a MRE would be much appreciated!

ciscoheat avatar Nov 08 '25 05:11 ciscoheat

Damn, I thought I could offer a mini repo to reproduce it, but I can't reproduce it by extracting all the code to keep just a single page.

And unfortunately, I can't make my repo public :/

What adjustments between these two versions could, in one way or another, cause such behavior?

Can I possibly show you the JS packages and my project tree with all package.json?

test-repo.zip

piolet avatar Nov 08 '25 09:11 piolet

Okay, I have to apologize :D

I just ran pnpm -r update, and it successfully updated superforms to version 2.28.1, as well as the AWS libraries to version 3.927.0.

I don't know if it was related, but those are the only two libraries that were updated, and now svelte-check is working.

Or maybe it was my other computer that was “sleeping badly” :D

In any case, as it stands, it seems to be working again today.

piolet avatar Nov 08 '25 09:11 piolet

No, the problem persists. When I run my build with CI/CD, it fails. It also fails on my Mac Studio, but not on my Mac Book Pro (Intel).

I don't know what the common factor is, but in any case, on the build, the image used is node:18-alpine3.18 and it crashes:

`apis/email-formatter check$ svelte-kit sync && svelte-check --tsconfig ./tsconfig.json

apis/email-formatter check: Loading svelte-check in workspace: /builds/folder/apis/email-formatter

apis/email-formatter check: Getting Svelte diagnostics...

apis/email-formatter check: <--- Last few GCs --->

apis/email-formatter check: [143:0x7d737dfee010] 121616 ms: Scavenge 2041.5 (2084.3) -> 2039.6 (2088.3) MB, 4.1 / 0.0 ms (average mu = 0.282, current mu = 0.062) allocation failure;

apis/email-formatter check: [143:0x7d737dfee010] 124060 ms: Mark-sweep (reduce) 2043.5 (2088.3) -> 2042.4 (2084.3) MB, 1996.2 / 0.0 ms (+ 229.9 ms in 61 steps since start of marking, biggest step 13.7 ms, walltime since start of marking 2267 ms) (average mu = 0.236, current mu =

apis/email-formatter check: <--- JS stacktrace --->

apis/email-formatter check: FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

apis/email-formatter check: Failed

/builds/folder/apis/email-formatter:

 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  [email protected] check: svelte-kit sync && svelte-check --tsconfig ./tsconfig.json

Command failed with signal "SIGABRT"

Aborted (core dumped)`

piolet avatar Nov 11 '25 12:11 piolet