mini-css-extract-plugin: v2.4.1 crashes due to a memory leak/exclude is broken

Bug report

My existing projet works fine with mini-css-extract-plugin@2.3.0. After upgrading to the latest v2.4.1 my project builds fail, seemingly due to some memory leak:

<--- Last few GCs --->

[146088:0x4e466f0]    18721 ms: Mark-sweep (reduce) 2045.8 (2051.7) -> 2045.5 (2054.7) MB, 652.9 / 0.0 ms  (average mu = 0.264, current mu = 0.019) allocation failure scavenge might not succeed
[146088:0x4e466f0]    19389 ms: Mark-sweep (reduce) 2046.5 (2055.2) -> 2046.3 (2055.7) MB, 665.6 / 0.0 ms  (average mu = 0.147, current mu = 0.004) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
 1: 0xa389b0 node::Abort() [node]
 2: 0x96e0af node::FatalError(char const*, char const*) [node]
 3: 0xbb7a4e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xbb7dc7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xd73fd5  [node]
 6: 0xda496e v8::internal::EvacuateNewSpaceVisitor::Visit(v8::internal::HeapObject, int) [node]
 7: 0xdb09a6 v8::internal::FullEvacuator::RawEvacuatePage(v8::internal::MemoryChunk*, long*) [node]
 8: 0xd9cb3f v8::internal::Evacuator::EvacuatePage(v8::internal::MemoryChunk*) [node]
 9: 0xd9cdb8 v8::internal::PageEvacuationTask::RunInParallel(v8::internal::ItemParallelJob::Task::Runner) [node]
10: 0xd8f699 v8::internal::ItemParallelJob::Run() [node]
...

Taking into account v2.4.1 release comments saying bug fix: crash with multiple webpack versions, my first guess, there are still some problems left. I am on the latest webpack@5.57.1, by the way.

Actual Behavior

Presumably v2.4.0 introduces some memory leak, causing crashes at least in some edge-cases.

Expected Behavior

Upgrade from v2.3.0 to v.2.4.1 should not lead to crashes in the projects where build worked with the previous versions.

How Do We Reproduce?

I had no chance to dig into it. I’ll provide a way to reproduce later, if you don’t have an idea already what might be wrong with it.

Please paste the results of npx webpack-cli info here, and mention other relevant information

npx: installed 50 in 7.909s

  System:
    OS: Linux 5.11 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
    Memory: 2.16 GB / 11.60 GB
  Binaries:
    Node: 14.18.0 - ~/.nvm/versions/node/v14.18.0/bin/node
    npm: 6.14.15 - ~/.nvm/versions/node/v14.18.0/bin/npm
  Browsers:
    Chrome: 94.0.4606.71
    Firefox: 92.0
  Packages:
    babel-loader: ^8.2.2 => 8.2.2 
    css-loader: ^6.3.0 => 6.3.0 
    css-minimizer-webpack-plugin: ^3.1.1 => 3.1.1 
    postcss-loader: ^6.1.1 => 6.1.1 
    resolve-url-loader: ^4.0.0 => 4.0.0 
    sass-loader: ^12.1.0 => 12.1.0 
    webpack: ^5.57.1 => 5.57.1 
    webpack-dev-middleware: ^5.2.1 => 5.2.1 
    webpack-hot-middleware: ^2.25.1 => 2.25.1 
    webpack-merge: ^5.8.0 => 5.8.0 
    workbox-webpack-plugin: ^6.3.0 => 6.3.0

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Found a problem, new API used .webpack special extensions to use importModule (new fast and low memory API), but you use exclude: [/styles\.css/, /editor\.css/], so you apply loader infinity time, workaround exclude: [/styles\.css/, /editor\.css/, /\.webpack/],, I think other developers has the same problem, but yes we should fix it, bug