getsentry / sentry-javascript-bundler-plugins

JavaScript Bundler Plugins for Sentry
https://sentry.io
BSD 3-Clause "New" or "Revised" License
142 stars 37 forks source link

sentry webpack plugin Fatal process out of memory: Zone #571

Closed oopses closed 4 months ago

oopses commented 4 months ago

Environment

"@sentry/webpack-plugin": "2.21.0" "webpack": "5.91.0", node 18.14.0 32

What version are you running? Etc. @sentry/webpack-plugin": "2.21.0"

Steps to Reproduce

devtool = 'source-map'

sentryWebpackPlugin({
  org: 'org',
  project: 'project',
  authToken: 'authToken',
  sourcemaps: {
    assets: './dist/**/*.js.map',
    filesToDeleteAfterUpload: 'dist/*.js.map'
  },
  release: {
    deploy: {
      env: 'env',
    },
  }
}),

Expected Result

upload sourceMap success

What you thought would happen.

Actual Result

 DONE  clear done
> building main process
[sentry-webpack-plugin] Warning: Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.
鈭� building main process
> building renderer process
> Found 4 files
> Analyzing 4 sources
> Rewriting sources
> Adding source map references
> Bundled 4 files for upload
> Bundle ID: xxxxxxx
> Uploaded files to Sentry
> File upload complete (processing pending on server)
> Organization: xxxxxxxx
> Project: xxxxxxxx
> Release: xxxxxxxxxxxxxxxxxxxxx
> Dist: None
> Upload type: artifact bundle

Source Map Upload Report
  Minified Scripts
    ~/main.js (sourcemap at main.js.map)
    ~/scriptWorker.js (sourcemap at scriptWorker.js.map)
  Source Maps
    ~/main.js.map
    ~/scriptWorker.js.map

#
# Fatal error in , line 0
# Fatal process out of memory: Zone
#
#
#
#FailureMessage Object: 0CE5A654
error Command failed with exit code 2147483651.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What actually happened. Maybe a screenshot/recording? Maybe some logs?

lforst commented 4 months ago

Hi, would you mind doing a memory profile of your build after assigning it more memory so that it passes? Otherwise this is hard to debug. Thanks!

oopses commented 4 months ago

Hi, would you mind doing a memory profile of your build after assigning it more memory so that it passes? Otherwise this is hard to debug. Thanks!

For the same project and build machine, I removed the sentry webpack plugin and no memory overflow occurred. I also tried to set the memory for node separately, NODE_OPTIONS=--max-old-space-size=10240, but it didn't work.

lforst commented 4 months ago

Would you be able to share a project where this is happening? Thanks!

oopses commented 4 months ago

Would you be able to share a project where this is happening? Thanks!

Sorry, this is an internal project of the company and I cannot share the source code. I am currently modifying the webpack script and plan to upload it using CLI. I will close this question first.

jaulz commented 3 months ago

Yeah, I noticed something similar in an internal project:

<--- Last few GCs --->

[10423:0x338f2200]    80878 ms: Mark-Compact 2039.4 (2085.0) -> 2038.3 (2085.6) MB, 1663.32 / 0.00 ms  (average mu = 0.390, current mu = 0.022) allocation failure; scavenge might not succeed
[10423:0x338f2200]    83204 ms: Mark-Compact 2040.4 (2085.8) -> 2039.6 (2091.0) MB, 2307.89 / 0.00 ms  (average mu = 0.202, current mu = 0.008) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0xb7d2ac node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/usr/bin/node]
 2: 0xeb218c v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/bin/node]
 3: 0xeb235c v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/usr/bin/node]
 4: 0x10b9f5c  [/usr/bin/node]
 5: 0x10d0434 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/bin/node]
 6: 0x10a919c v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]
 7: 0x10a9f60 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/bin/node]
 8: 0x1089c9c v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/bin/node]
 9: 0x149b9d4 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/node]
10: 0x189ca84  [/usr/bin/node]

Did you find a way to solve it?

wong2 commented 2 months ago

We're facing this in the Vite plugin. But I can't be sure this is caused by the plugin.

lforst commented 2 months ago

Unfortunately we would need reproduction to investigate this further!