Skip to content

process not closing with thread-loader >=2.0.1 #56

@bdwain

Description

@bdwain

I have an instance of webpack dev server running in a forked process from my main process, and I noticed the fork started sticking around after the main process is closed, when it should be getting closed also. My project uses the thread-loader for babel-loader. The behavior started when I upgraded from thread-loader 2.0.0, and I've narrowed it down to being introduced in 2.0.1, and the only commit in it is #51.

I'm still working on an example I can link to, but basically my code looks like this

//main process
  let child = fork(path.resolve(__dirname, './run-dev-server.js'), params);

  process.on('exit', function(){
    console.log('EXITING')
    child.kill();
  });

//run-dev-server.js

const compiler = webpack(config);
const server = new webpackDevServer(compiler, serverOptions);
server.listen(port, host);

//webpack rule in webpack.config.js
{
  test: /\.js$/,
  exclude: /node_modules|babel-helpers/,
  use: [
    'thread-loader',
    {
       loader: 'babel-loader',
       options: {
         cacheDirectory: true,
         extends: path.join(__dirname, '../.babelrc')
       }
    }
  ]
}

when i try to exit the main process, I see that EXITING gets printed, but now the forked process sticks around in the background still running webpack-dev-server. I might be able to change the signal I send to something that can't be ignored, but that seems like something I shouldn't have to do.

The behavior is not present in v2.0.0 (things work there), but 2.0.1 can reliably reproduce it. I'll try to get something I can link to though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions