webpack-cli icon indicating copy to clipboard operation
webpack-cli copied to clipboard

filesystem cache corruption on SIGINT

Open AprilArcus opened this issue 3 years ago • 7 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.

AprilArcus avatar Aug 24 '21 22:08 AprilArcus

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

alexander-akait avatar Aug 25 '21 10:08 alexander-akait

I will fix it.

snitin315 avatar Aug 25 '21 10:08 snitin315

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();
      });

snitin315 avatar Aug 25 '21 10:08 snitin315

Here https://github.com/webpack/webpack-cli/blob/master/packages/webpack-cli/lib/webpack-cli.js#L2122 and also here https://github.com/webpack/webpack-cli/blob/master/packages/webpack-cli/lib/webpack-cli.js#L2135

alexander-akait avatar Aug 25 '21 10:08 alexander-akait

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.

webpack-bot avatar Feb 24 '22 07:02 webpack-bot

Don't lock

AprilArcus avatar Feb 24 '22 07:02 AprilArcus

Issue was closed because of inactivity.

If you think this is still a valid issue, please file a new issue with additional information.

webpack-bot avatar Mar 01 '23 20:03 webpack-bot

Sorry for long fix :disappointed:

alexander-akait avatar Apr 10 '24 15:04 alexander-akait