Webpack hangs until "process out of memory" error
See original GitHub issueI’m submitting a bug report
Webpack version: 3.1.0
Webpack Karma version: 2.0.4
Karma version: 1.7.0
Please tell us about your environment: OSX 10.12.5
Browser: Chrome 59.0.3071.115
Current behavior:
Webpack hangs while creating initial bundles, until eventually aborting with FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory.
Expected/desired behavior: Webpack would correctly bundle the files and the test suite would be run.
Gulp config:
const path = require('path');
const gulp = require('gulp');
const { Server } = require('karma');
const rootPath = path.join(__dirname, '..', '..');
gulp.task('karma:modules', (done) => {
new Server({
configFile: path.resolve('wf_modules/karma.conf.js'),
browsers: ['Chrome', 'Firefox'],
files: [
require.resolve('wf_polyfills/polyfills.min.js'),
path.join(rootPath, 'browser_tests/js/setup.js'),
path.join(rootPath, 'browser_tests/src-test/**/*.js'),
path.join(rootPath, 'common_tests/src-test/**/*.js')
]
}, done).start();
});
Karma config:
require('babel-core/register');
const path = require('path');
const webpack = require('webpack');
const testPaths = [
__dirname,
path.join(__dirname, 'browser')
];
module.exports = function(config) {
config.set({
frameworks: ['mocha'],
files: [
'../node_modules/wf_polyfills/polyfills.min.js',
'browser_tests/js/setup.js',
'browser_tests/src-test/**/*.js',
'common_tests/src-test/**/*.js'
],
preprocessors: {
'browser_tests/js/setup.js': ['webpack'],
'browser_tests/src-test/**/*.js': ['webpack'],
'common_tests/src-test/**/*.js': ['webpack']
},
webpack: {
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader?cacheDirectory=true'
}
}
]
},
resolve: {
modules: [...testPaths, 'node_modules']
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
]
},
reporters: ['dots'],
logLevel: 'debug',
autoWatch: false,
singleRun: true,
browserNoActivityTimeout: 60000,
reportSlowerThan: 1000
});
};
Full error output:
<--- Last few GCs --->
171011 ms: Scavenge 4355.3 (4435.5) -> 4355.3 (4435.5) MB, 0.5 / 0 ms (+ 5.5 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
171476 ms: Mark-sweep 4355.3 (4435.5) -> 4346.0 (4427.0) MB, 464.4 / 0 ms (+ 18.6 ms in 3 steps since start of marking, biggest step 10.7 ms) [last resort gc].
171937 ms: Mark-sweep 4346.0 (4427.0) -> 4346.4 (4427.0) MB, 461.8 / 0 ms [last resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x84dfd5b4629 <JS Object>
2: new constructor(aka Buffer) [buffer.js:~50] [pc=0x5d96174aab5] (this=0x38b37c1a4d1 <a Buffer with map 0x2432238174a9>,arg=0x139cae404101 <Very long string[2218385]>,encoding=0x84dfd5bd739 <String[4]: utf8>)
4: writeOut [/Users/me/Repos/my_repo/node_modules/webpack/lib/Compiler.js:343] [pc=0x5d9617cd5b6] (this=0x1d37c435eb11 <a Compiler with map 0x2432238da641>,err=0x84dfd504101 <nul...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
Abort trap: 6
This also still occurs if I use the node --max_old_space_size=4096 flag.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:6
Top Results From Across the Web
out of memory · Issue #2157 · webpack/webpack - GitHub
I was having this issue after adding a decent amount of json in a file (~3.6Mb) as a direct export. It seemed to...
Read more >Webpack out of memory - Stack Overflow
The issue is caused by a memory leak in postcss-loader. The one liner below has worked for some. rm -rf [package-lock.json] node_modules &&...
Read more >Fix out-of-memory issues during webpack compile - GitLab
Our webpack compile process is teetering on the edge of node's default memory limits and it is causing problems. Our webpack:assets:compile ...
Read more >Webpack: How to fix "Heap out of memory - m4x
Depending on the Node version this error means that you have reached the limit of what can be held in memory for your...
Read more >Troubleshooting Lambda configurations - AWS Documentation
Memory configurations. You can configure a Lambda function to use between 128 MB and 10,240 MB. By default, any function created in the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Re-opened as we’re still seeing this issue. It looks to only occur when using
devtool: 'inline-source-map'. This would be a non-issue if external source maps functioned correctly, but they do not as seen in #224Any updates on this?