Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

filesystem cache corruption on SIGINT #2918

Closed
AprilArcus opened this issue Aug 24, 2021 · 8 comments · Fixed by #4145
Closed

filesystem cache corruption on SIGINT #2918

AprilArcus opened this issue Aug 24, 2021 · 8 comments · Fixed by #4145
Labels

Comments

@AprilArcus
Copy link

AprilArcus commented Aug 24, 2021

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 AprilArcus added the Bug label Aug 24, 2021
@alexander-akait
Copy link
Member

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

@snitin315
Copy link
Member

I will fix it.

@snitin315
Copy link
Member

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

@webpack-bot
Copy link

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.

@AprilArcus
Copy link
Author

Don't lock

@webpack-bot
Copy link

Issue was closed because of inactivity.

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

@alexander-akait
Copy link
Member

Sorry for long fix 😞

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
4 participants