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

Update npm run to fix hpe_header_overflow in recent nodejs versions #3732

Merged
merged 1 commit into from
Apr 29, 2019

Conversation

guwenqing
Copy link
Contributor

The change is needed to fix hpe_header_overflow in recent nodejs versions.

Nodejs has set max header size to 8k in http_parser from v10.14.2 in LTS versions,
need to run webpack devServer with a larger header size to make the proxy work.

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • New Query Runner (Data Source)
  • New Alert Destination
  • Other

Description

Nodejs has set max header size to 8k in http_parser from v10.14.2 in LTS versions,
need to run webpack devServer with a larger header size to make the proxy work.
Issue is reported to webpack and workaround has been presented here:
webpack/webpack-dev-server#1711

Not sure if existing dev documents should be updated to tell which version of nodejs should be used. The override as used in this change is only applicable to nodejs version higher than v10.15.0.

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

Nodejs has set max header size to 8k in http_parser,
need to provide a larger header size to make the proxy work.
Copy link
Member

@gabrieldutra gabrieldutra left a comment

Choose a reason for hiding this comment

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

@arikfr this seems a simple workaround for the issue with npm run start. I've tested it here, it works to me and also it doesn't seem to break the command for old Node versions (I've tested it with version 6). Do you have any other comments for it?

@arikfr arikfr merged commit c9bf412 into getredash:master Apr 29, 2019
@arikfr
Copy link
Member

arikfr commented Apr 29, 2019

Super! Thanks, @guwenqing :)

@arikfr
Copy link
Member

arikfr commented May 2, 2019

I'm getting the following error:

node: bad option: --max-http-header-size=16385

Is it possible this option is available only in newer versions of Node? (I'm using v10)

@guwenqing
Copy link
Contributor Author

According to what I read, it should only be used with later version. That is why I mentioned if we should modify the dev guide.
Not sure if a better workaround should be created to do differently based on different version.

@gabrieldutra
Copy link
Member

gabrieldutra commented May 2, 2019

I'm running it without issues in node v10.15.3. I also checked docker-compose run --rm server npm run start to see what would happen with an old version of node (v6.16.0), also no issues to run the command. In any case as this affects only npm run start and the command wasn't working before due to this proxy issue...

How about adding a note that npm run start is available for Node >v10.14.2 (maybe this is your issue @arikfr?) and for any version prior to it there's npm run watch?

@arikfr
Copy link
Member

arikfr commented May 13, 2019

@gabrieldutra I wonder if the default should be support the new version? I mean, it's more likely that most people use an older version?

@gabrieldutra
Copy link
Member

@gabrieldutra I wonder if the default should be support the new version? I mean, it's more likely that most people use an older version?

The Max Header issue seemed to be introduced in a secure release and to affect minors (I was thinking it was major related before 😬) from: 6.15, 8.14, 10.14 and 11.3. As it's a secure release, it should affect the majority of people at some point...

This explains why my test with v6.16.0 worked...

There's the option of a workaround like

"start": "node --max-http-header-size=16385 ./node_modules/webpack-dev-server/bin/webpack-dev-server.js || webpack-dev-server"

But there are issues with it...

@deecay
Copy link
Contributor

deecay commented May 16, 2019

How is the value 16385 chosen? I needed to increase this value to perform a fork.

@arikfr
Copy link
Member

arikfr commented May 16, 2019

@gabrieldutra can't say I was much worried about security issues to upgrade local Node version... :)

@deecay is it consistent that on every fork request it fails with the 16385 value? If it is, can you try disabling chromelogger and check if it solves this?

You can disable it by changing this function:

def init_app(app):
if not app.debug:
return
app.after_request(chrome_log)

@deecay
Copy link
Contributor

deecay commented May 16, 2019

@arikfr Query with 0 or 1 visualization are okay. Query with 2 or more visualization failed to fork.

If I disable chrome_logger, then the issue went away.

cmdcolin added a commit to GMOD/jbrowse-components that referenced this pull request Nov 2, 2019
gabrieldutra added a commit that referenced this pull request Nov 13, 2019
harveyrendell pushed a commit to pushpay/redash that referenced this pull request Nov 14, 2019
Nodejs has set max header size to 8k in http_parser,
need to provide a larger header size to make the proxy work.
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