sass / embedded-host-node

A Node.js library that will communicate with Embedded Dart Sass using the Embedded Sass protocol
MIT License
143 stars 26 forks source link

Errors when using with sass-loader #296

Open VioletFlare opened 4 months ago

VioletFlare commented 4 months ago

Hello,

I have a pretty large codebase to compile and I was trying sass-embedded. When I am running webpack with the following config:

                    {
                        loader: 'sass-loader',
                        options: {
                            sassOptions: {
                                sourceMap: true,
                                includePaths: [path.resolve(__dirname, 'Develop', 'Styles'), path.resolve(__dirname, 'WebComponents')],
                            },
                            implementation: require('sass-embedded')
                        }
                    }

Dart errors with the following error:

> webpack --config webpack.configs.dev.js --watch

../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22
../../runtime/bin/eventhandler_win.cc: 318: error: Failed to start read file thread 22

It looks like evenhandler_win.cc is a dart file.

https://github.com/dart-lang/sdk/blob/5e61fe62bc5179cf3c032a2362182dd7a5ed7a38/runtime/bin/eventhandler_win.cc#L9

nex3 commented 4 months ago

Can you provide a clean reproduction of this, ideally only using the Sass embedded API without the WebPack loader around it?

VioletFlare commented 4 months ago

Can you provide a clean reproduction of this, ideally only using the Sass embedded API without the WebPack loader around it?

Sorry, I cannot make a reproducible example using only sass-embedded api right now. However I have something that might aid in the reproduction of this case or which might serve as a temporary solution.

While I was running the webpack build using sass-embedded, the memory usage grew to 8 GB between the various node processes and dart executables running and got to a point where no memory was available. At some point I was running out of physical memory, my disk was nearly full (had nearly 250 MB left), after cleaning my disk I am not running into this issue anymore.

I forgot to mention I am using windows :)

So it seems as something related to Windows Virtual Memory management or Dart itself.

nex3 commented 4 months ago

That sounds like it may be an issue with sass-loader spawning too many instances of sass-embedded concurrently. This should be fixed by https://github.com/webpack-contrib/sass-loader/pull/1195, but if you're using a version of WebPack that includes that PR you might want to file an issue there explaining the problem.