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

Node v16.3.0 crash - Cannot read properties of null (reading 'statusCode') #4319

Closed
richardlay opened this issue Nov 22, 2021 · 5 comments
Closed
Labels
support Questions, discussions, and general support

Comments

@richardlay
Copy link

richardlay commented Nov 22, 2021

Support plan

  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): yes

Context

  • node version: 16.3.0
  • module version with issue: 20.2.0
  • last module version without issue: 19.1.1
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): hapi application
  • any other relevant information: Using AWS load balancer

What are you trying to achieve or the steps to reproduce?

When our AWS Load Balancer returns a HTTP 460 because the client closed the connection, the handling node application crashes with the following stack trace:

TypeError: Cannot read properties of null (reading 'statusCode')
at Request._finalize (/src/node_modules/@hapi/hapi/lib/request.js:500:31)
at Request._reply (/src/node_modules/@hapi/hapi/lib/request.js:437:18)
at Request._execute (/src/node_modules/@hapi/hapi/lib/request.js:282:14)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

This wasn't happening when we were using Hapi 19.1.1 with Node 14.

I've found some issues that appear similar:

This issue #4208, we're getting the error on the same line of code:

 if (this.response.statusCode === 500 &&

Also this comment #4225 (comment) suggests premature close events were fixed as of Hapi 20.1.2, so we're wondering if there is another edge case.

What was the result you got?

Node application crashes

What result did you expect?

The server to function normally and respond to requests

@richardlay richardlay added the support Questions, discussions, and general support label Nov 22, 2021
@devinivy
Copy link
Member

devinivy commented Nov 22, 2021

Thanks for the report! The latest version of hapi v20.2.1 included a fix #4295 for a crash related to handling of client aborts. Could you update to that version and see if the issue persists?

@richardlay
Copy link
Author

Thanks, will do.

@maxkueng
Copy link

I've had the same error after switching to Node 16 and updating Hapi to v20.2.1 made it go away 👍

@richardlay
Copy link
Author

It's been almost a week since we went live with v20.2.1. We have not yet experienced a crash so it appears this version has fixed our issue.
Thanks 🙏

@devinivy
Copy link
Member

devinivy commented Dec 1, 2021

Fantastic, thank you for following-up!

@devinivy devinivy closed this as completed Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Questions, discussions, and general support
Projects
None yet
Development

No branches or pull requests

3 participants