Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Ensure child processes are killed #364

Closed
wants to merge 1 commit into from

Conversation

leifcr
Copy link

@leifcr leifcr commented May 10, 2017

When running webpacker dev server under foreman or guard-process, the node child process can sometimes continue to run. This ensure the child process is killed.

To test, install foreman gem install foreman, then add this to a Procfile:

web: bundle exec rails server
webpacker: ./bin/webpack-dev-server

Run foreman start

Start a new terminal and run foreman stop, and ps aux | grep webpacker will sometimes show the child process continue in the background.

Hitting ctrl+c when running interactive with foreman terminates the command properly, while start/stop does not. Seems like SIGINT is captured by the child process, while SIGTERM is not.

When running webpacker dev server under foreman or guard-process, the node child process can sometimes continue to run. This ensure the child process is killed.
Copy link
Member

@guilleiguaran guilleiguaran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we would need to research for "Windows-compatible" fix for this before of proceeding

Thanks for your contribution!!

Dir.chdir(APP_PATH) do
exec newenv, *cmdline
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it's currently using exec, the immediate "child" process takes over here. That would seem to make any handling of further processes a matter for that one (the real webpack-dev-server). Does that process not manifest the same problem if run directly?

@gauravtiwari
Copy link
Member

@leifcr Actually never had this issue with foreman. Please could you add --watch-stdin or --stdin arg to binstub and see if the issue still persist?

cmdline = [DEV_SERVER_BIN, "--", "--progress", "--color", "--watch-stdin", "--config", DEV_SERVER_CONFIG] + ARGV

@leifcr
Copy link
Author

leifcr commented May 15, 2017

I've tested more and found that the initial test app I created used Rails 5.1 0 + webpack 1.2, which has a bit different webpack-dev-server bin from PR #367.

PR #367 solves the problem by using yarn run webpack-dev-server, which also tracks child processes, and properly kills them.

Closing this, as the solution in #367 is merged.

@gauravtiwari, @matthewd and @guilleiguaran: Thanks for looking into this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants