webpack/webpack-cli

filesystem cache corruption on SIGINT

AprilArcus opened this issue · 8 comments

If webpack-cli is terminated by SIGINT while writing to the filesystem cache (e.g. in watch mode during an incremental rebuild of a project with large external source maps), the filesystem cache will be corrupted and must be erased before webpack will build again.

webpack-cli should hook SIGINT and await a clean exit from compiler.close.

Note that the child processes spawned by e.g. fork-ts-checker-webpack-plugin or thread-loader will hear SIGINT from the parent process, so they'll need to be isolated by spawning the compiler into a detached child process.

/cc @webpack/cli-team should be easy, we should add listener before running webpack and run close when SIGINT happens

I will fix it.

It should be added here, right?

https://github.com/webpack/webpack-cli/blob/master/packages/webpack-cli/lib/webpack-cli.js#L2057

      process.on("SIGINT", () => {
        compiler.close();
      });

This issue had no activity for at least half a year.

It's subject to automatic issue closing if there is no activity in the next 15 days.

Don't lock