Skip to content

Sveltekit - Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory #10589

Open
@MSDev201

Description

@MSDev201

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/sveltekit

SDK Version

7.100.1

Framework Version

Sveltekit 2.4.0

Link to Sentry event

No response

SDK Setup

vite.config.js

import { sveltekit } from "@sveltejs/kit/vite";
import { sentrySvelteKit } from "@sentry/sveltekit";

/** @type {import('vite').UserConfig} */
const config = {
    plugins: [
        sentrySvelteKit({
            autoUploadSourceMaps: true,
            sourceMapsUploadOptions: {
                cleanArtifacts: true,
                rewrite: false,
            },
        }),
        sveltekit(),
    ],
};
export default config;

Steps to Reproduce

  1. Use npx @sentry/wizard@latest -i sveltekit and follow the prompts
  2. Run vite build
  3. Get heap out of memory error

We are having some circular dependencies in a few of our dependencies, not sure if this could cause the issue.

Expected Result

Vite build should finish with a success code and dont consume all of my memory.

Actual Result

Sourcemap and Release are successfully published and it looks like everything has finished successfully but right before stopping, it consumes infinite amount of memory. I tested with NODE_OPTIONS=--max-old-space-size=16384 but still get a 'out of memory' error.

getsentry/sentry-javascript#17 101.3 [***-vite-plugin] Info: Successfully uploaded source maps.
getsentry/sentry-javascript#17 102.5 [***-vite-plugin] Info: Successfully finalized release.
getsentry/sentry-javascript#17 128.4 
getsentry/sentry-javascript#17 128.4 <--- Last few GCs --->
getsentry/sentry-javascript#17 128.4 
getsentry/sentry-javascript#17 128.4 [41:0x5a2e330]   123431 ms: Scavenge (reduce) 2031.6 (2064.8) -> 2031.4 (2064.8) MB, 9.7 / 0.0 ms  (average mu = 0.259, current mu = 0.269) allocation failure; 
getsentry/sentry-javascript#17 128.4 [41:0x5a2e330]   123455 ms: Scavenge (reduce) 2034.7 (2068.1) -> 2034.7 (2068.3) MB, 20.5 / 0.0 ms  (average mu = 0.259, current mu = 0.269) allocation failure; 
getsentry/sentry-javascript#17 128.4 [41:0x5a2e330]   123905 ms: Scavenge (reduce) 2035.4 (2069.0) -> 2035.4 (2069.0) MB, 5.0 / 0.0 ms  (average mu = 0.259, current mu = 0.269) allocation failure; 
getsentry/sentry-javascript#17 128.4 
getsentry/sentry-javascript#17 128.4 
getsentry/sentry-javascript#17 128.4 <--- JS stacktrace --->
getsentry/sentry-javascript#17 128.4 
getsentry/sentry-javascript#17 128.4 FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
getsentry/sentry-javascript#17 128.4  1: 0xbdd160 node::Abort() [node]
getsentry/sentry-javascript#17 128.4  2: 0xaf089c  [node]
getsentry/sentry-javascript#17 128.4  3: 0xdcc1d0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
getsentry/sentry-javascript#17 128.4  4: 0xdcc586 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
getsentry/sentry-javascript#17 128.4  5: 0xfcb005  [node]
getsentry/sentry-javascript#17 128.4  6: 0xfcb5b6 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
getsentry/sentry-javascript#17 128.4  7: 0xfdd8a6  [node]
getsentry/sentry-javascript#17 128.4  8: 0xfde4e5 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
getsentry/sentry-javascript#17 128.4  9: 0xfba49f v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
getsentry/sentry-javascript#17 128.4 10: 0xfbb4e7 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
getsentry/sentry-javascript#17 128.4 11: 0xf9ac4a v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
getsentry/sentry-javascript#17 128.4 12: 0x13ae67d v8::internal::Runtime_AllocateInOldGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
getsentry/sentry-javascript#17 128.4 13: 0x18343f9  [node]
getsentry/sentry-javascript#17 128.8 Aborted (core dumped)
getsentry/sentry-javascript#17 ERROR: process "/bin/sh -c npm run build" did not complete successfully: exit code: 134

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugExternal DependencyTo close this issue, an external dependency needs to be adjusted/fixedSvelteKit

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions