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

fix: re-throw error to kill server #2630

Merged
merged 14 commits into from
Sep 8, 2020

Conversation

emilyrohrbough
Copy link

  • This is a bugfix
  • This is a feature
  • This is a code refactor
  • This is a test update
  • This is a docs update
  • This is a metadata update

For Bugs and Features; did you add new tests?

Yes

Motivation / Use-Case

Closes #2624

Re-throw an error to kill the server instead of logging and hanging.

Breaking Changes

Process will exit when an error occurs instead of hanging.

Additional Info

Terminal output when error is thrown:
Screen Shot 2020-05-27 at 1 38 40 PM

@jsf-clabot
Copy link

jsf-clabot commented May 27, 2020

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented May 27, 2020

Codecov Report

Merging #2630 into v4 will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##               v4    #2630   +/-   ##
=======================================
  Coverage   92.88%   92.88%           
=======================================
  Files          39       39           
  Lines        1308     1308           
  Branches      350      350           
=======================================
  Hits         1215     1215           
  Misses         89       89           
  Partials        4        4           
Impacted Files Coverage Δ
lib/Server.js 96.33% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2090a41...9bc2ff8. Read the comment docs.

@emilyrohrbough
Copy link
Author

emilyrohrbough commented May 27, 2020

Are these tests typically flaky? Is it possible to kick off another test run or did I miss a step required for tests?

@alexander-akait
Copy link
Member

@emilyrohrbough should no, server is freeze without throw?

@emilyrohrbough
Copy link
Author

Yes, without throwing the error, the server fails to start while the webpack compilation continues

@emilyrohrbough
Copy link
Author

@evilebottnawi I reverted my changes to see if they had an impact on the test. It seems they are still failing. Do you have any insights on how to resolve these?

Client console.log › clientLogLevel is silent

TypeError: DirectoryWatcher is not a constructor

  at WatcherManager.Object.<anonymous>.WatcherManager.getDirectoryWatcher (node_modules/watchpack/lib/watcherManager.js:20:35)
  at WatcherManager.watchFile (node_modules/watchpack/lib/watcherManager.js:31:15)
  at Watchpack.<anonymous> (node_modules/watchpack/lib/watchpack.js:38:51)
      at Array.map (<anonymous>)
  at Watchpack.watch (node_modules/watchpack/lib/watchpack.js:37:29)
  at NodeWatchFileSystem.watch (node_modules/webpack/lib/node/NodeWatchFileSystem.js:72:18)

They don't seem to be related to my changes.
Screen Shot 2020-06-04 at 8 59 39 AM

Update Server.test.js
@Mayank1791989
Copy link

@evilebottnawi & @emilyrohrbough Any updates on this?

@alexander-akait
Copy link
Member

@emilyrohrbough can you change branch on v4?

@Mayank1791989
Copy link

@evilebottnawi Do you think there is any point of adding error listener if we anyways throwing and killing the server, This will already happen if we don't add listener.

@alexander-akait
Copy link
Member

@Mayank1791989 Some errors can be critical, some of them not, I think so, so we added it, but we probably need a little more tests, maybe you are right and we do not need a listener

@emilyrohrbough emilyrohrbough changed the base branch from master to v4 September 4, 2020 13:27
@emilyrohrbough
Copy link
Author

I could see value in both, depending on where / how this is being used, one could catch this error and handle it gracefully or just exit the process.

@alexander-akait
Copy link
Member

@emilyrohrbough Yes, but in our case, we should log it, maybe it is unnecessary here

@emilyrohrbough
Copy link
Author

Shall I remove the log?

@alexander-akait
Copy link
Member

I think yes, because you already see error message 😄

@emilyrohrbough
Copy link
Author

okay great! I'll make that change & fix these merge conflict soon.

@alexander-akait
Copy link
Member

Thanks!

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

@hiroppy
Copy link
Member

hiroppy commented Sep 6, 2020

@emilyrohrbough Why did you update package-lock.json? I think it's unnecessary

@emilyrohrbough
Copy link
Author

@hiroppy I did update it. I can revert to the locked in versions.

@emilyrohrbough
Copy link
Author

@hiroppy It seems one or more of the locked in dependencies aren't compatible with node 12. I think the package-lock updates are needed.

@hiroppy
Copy link
Member

hiroppy commented Sep 8, 2020

@emilyrohrbough sorry I can't understand. This pr changed only this.

    this.listeningApp.on('error', (err) => {
      this.logger.error(err);
      throw err;
    });

And v4 branch's CI is fine v10, 12, and 14 even if we don't update package-lock.json.
see #2592

@emilyrohrbough
Copy link
Author

@hiroppy I'm looking at #2592 and it looks like lint /the node 12.x is failing. Is that from something else?
Screen Shot 2020-09-08 at 6 14 48 PM

@hiroppy
Copy link
Member

hiroppy commented Sep 8, 2020

@emilyrohrbough This is lint CI.

@emilyrohrbough
Copy link
Author

Is it okay if lint on node 12 fails? That was the only check failing when the package-lock was not updated:
Screen Shot 2020-09-08 at 6 18 07 PM

@hiroppy
Copy link
Member

hiroppy commented Sep 8, 2020

@emilyrohrbough

V4 branch has incorrect commit messages so CI isn't green.

Screen Shot 2020-09-09 at 8 19 01

Sorry, I misread, I thought your screenshot is v4...

@hiroppy
Copy link
Member

hiroppy commented Sep 8, 2020

Thank you for rerunning. ok, understood. So did you run npm ci && npm audit fix?

@emilyrohrbough
Copy link
Author

emilyrohrbough commented Sep 8, 2020

@hiroppy Yes can do No I ran rm -rf node_modules; rm package-lock.json; npm install to regenerate. I will run npm ci && npm audit fix instead.

@hiroppy
Copy link
Member

hiroppy commented Sep 8, 2020

@emilyrohrbough Thanks! This PR looks good to me and CI is green.

@emilyrohrbough
Copy link
Author

emilyrohrbough commented Sep 8, 2020

@hiroppy The build has passed. Are you okay with these changes?

@hiroppy hiroppy merged commit 161e3d8 into webpack:v4 Sep 8, 2020
@hiroppy
Copy link
Member

hiroppy commented Sep 8, 2020

thanks

@emilyrohrbough
Copy link
Author

thank you!

@emilyrohrbough emilyrohrbough deleted the fix-swallowed-error branch September 9, 2020 20:58
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.

Server Errors are Swallowed Causing Process to Hang When Server Did Not Start
5 participants