Skip to content

Conversation

@kevinburke
Copy link

In the event that the read stream terminates before all of the data
has been read, the pipe will send an 'end' event. We should listen for
this event and hit the callback with it, instead of hanging forever.

Added tests to verify this. Verified the patch fixes the problem by
running the tests without the patch, observing that they timeout, then
running the tests with the patch and verifying you get an error back.

@jsf-clabot
Copy link

jsf-clabot commented Oct 4, 2018

CLA assistant check
All committers have signed the CLA.

@kevinburke kevinburke force-pushed the listen-for-end-event branch from 585ba62 to fe6bb2d Compare October 5, 2018 00:19
@codecov
Copy link

codecov bot commented Oct 5, 2018

Codecov Report

Merging #36 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@         Coverage Diff          @@
##           master   #36   +/-   ##
====================================
  Coverage       0%    0%           
====================================
  Files           7     7           
  Lines         372   384   +12     
  Branches       66    68    +2     
====================================
- Misses        325   335   +10     
- Partials       47    49    +2
Impacted Files Coverage Δ
src/readBuffer.js 0% <0%> (ø) ⬆️

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 e07fe0e...326045c. Read the comment docs.

@kevinburke kevinburke force-pushed the listen-for-end-event branch 6 times, most recently from 0579453 to ea7267d Compare October 5, 2018 17:23
kevinburke added a commit to sourcegraph/sourcegraph-public-snapshot that referenced this pull request Oct 5, 2018
The thread-loader package starts several subprocesses. When you send
a SIGINT to thread-loader, the subprocesses terminate, but the parent
process hangs while waiting for them to send data. We were not
listening for the 'end' event in the parent process which meant that
the webpack processes would just hang forever.

This is a problem because this blocks the shutdown of goreman which
means we can have orphan processes and is, in general, a huge hassle
when developing the codebase locally.

Fix this by listening for an 'end' event, which means we can signal to
Webpack that the job terminated with an error, instead of not
terminating. This means that SIGINT will actually shut down the
process instead of leaving it hanging forever.

Fixes sourcegraph/sourcegraph#186.
Updates webpack/thread-loader#33.
Updates webpack/thread-loader#34.
Updates webpack/thread-loader#35.
Updates webpack/thread-loader#36.
@mistic
Copy link
Collaborator

mistic commented Dec 12, 2018

@evilebottnawi you review this please? I have also found this issue in a simple use case #39

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.

Other look good. Thanks!

.travis.yml Outdated
before_script: npm i --no-save git://github.com/webpack/webpack.git#master
script: npm run travis:$JOB_PART
node_js: 8
node_js: 10
Copy link
Member

Choose a reason for hiding this comment

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

I think canary tests should be on minimum supported node, i.e. 6

Copy link
Author

Choose a reason for hiding this comment

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

Done

@mistic
Copy link
Collaborator

mistic commented Dec 13, 2018

@kevinburke can you check the review and change accordingly please?

@alexander-akait
Copy link
Member

@kevinburke Also please accept CLA

@kevinburke
Copy link
Author

I've signed the CLA.

@kevinburke kevinburke force-pushed the listen-for-end-event branch 2 times, most recently from 7939a4f to e34202a Compare December 13, 2018 23:25
@mistic mistic mentioned this pull request Dec 14, 2018
@mistic
Copy link
Collaborator

mistic commented Dec 14, 2018

@kevinburke the build for this PR should become green after merging #44

After it gets merged, can you merge this branch with master so you can have a green CI before merging it?

@alexander-akait
Copy link
Member

Need rebase, feel free to ping me when it is done or recreate the PR

@kevinburke kevinburke force-pushed the listen-for-end-event branch 3 times, most recently from d9d54db to 63cc203 Compare December 14, 2018 11:08
Attempting to run "npm install" on a new-ish Mac with Node v10.11
fails with a number of node-gyp compilation failures. Installing and
using the latest versions of node-sass, nan, and fsevents resolves
this failure, as each of those packages resolves the issues that led
to problems.

Update lodash to v4.17.11 to fix a security warning present in the
Travis CI configuration.

Add Node 10 to the build matrix so we can test for it.

I am nervous about the number of changes to package-lock.json and I am
not sure how to mitigate that - apparently NPM 6 changed the way
requirements are stored in the file so we'll just have to do this at
some point. npm/npm#20434
In the event that the read stream terminates before all of the data
has been read, the pipe will send an 'end' event. We should listen for
this event and hit the callback with it, instead of hanging forever.

Added tests to verify this. Verified the patch fixes the problem by
running the tests without the patch, observing that they timeout, then
running the tests with the patch and verifying you get an error back.
@kevinburke
Copy link
Author

I rebased but I'm not happy as I am not sure I can verify the changes in package-lock.json are correct.

I submitted a change that just runs "dedupe" on its own, once that is merged maybe the diff here will be clearer.

@alexander-akait
Copy link
Member

@kevinburke you should not care about package-lock.json

@alexander-akait
Copy link
Member

@kevinburke

                    === npm audit security report ===                        
                                                                                
# Run  npm update cryptiles --depth 9  to resolve 3 vulnerabilities
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Insufficient Entropy                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ cryptiles                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ jest [dev]                                                   │
├───────────────┼─────────────────────���────────────────────────────────────────┤
│ Path          │ jest > jest-cli > jest-config > jest-environment-jsdom >     │
│               │ jsdom > request > hawk > cryptiles                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/720                       │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Insufficient Entropy                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ cryptiles                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ jest [dev]                                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ jest > jest-cli > jest-environment-jsdom > jsdom > request > │
│               │ hawk > cryptiles                                             │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/720                       │
└───────────────┴─────────────────���────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Insufficient Entropy                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ cryptiles                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ jest [dev]                                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ jest > jest-cli > jest-runtime > jest-config >               │
│               │ jest-environment-jsdom > jsdom > request > hawk > cryptiles  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/720                       │
└───────────────┴──────────────────────────────────────────────────────────────┘
[!] 3 vulnerabilities found - Packages audited: 12018 (12010 dev, 291 optional)
    Severity: 3 High

Just send a PR with updating deps

@alexander-akait
Copy link
Member

Try rm -r package-lock.json && rm -r node_modules && npm i

@kevinburke
Copy link
Author

kevinburke commented Dec 14, 2018 via email

@alexander-akait
Copy link
Member

alexander-akait commented Dec 14, 2018

@kevinburke no need audit dependencies just update this deps and all, need update jest and all

@kevinburke
Copy link
Author

kevinburke commented Dec 14, 2018 via email

@mistic
Copy link
Collaborator

mistic commented Dec 14, 2018

@kevinburke I think it's not realistic to think we can manually audit every dependency from our 3rd party dependencies as a project grows. What we should do, as in any matter of security, is to adopt the best standard procedures which I think we are already doing here running the npm audit in every build. The package.json was regenerated and audited just using the automated npm tasks npm install && npm audit fix

@mistic
Copy link
Collaborator

mistic commented Dec 14, 2018

@kevinburke I've opened a PR to bump the old used dependencies and just run npm audit fix #47.

@alexander-akait
Copy link
Member

Need rebase

@alexander-akait
Copy link
Member

Done in #42, thanks for PRs and thanks for help

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