-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
hapi server throw [FIN, ACK] and [RST] #3738
Comments
@kanongil any ideas on this? |
Looks like a race condition of sorts. A response is sent to client for original req, server waits exactly 5 seconds for more data and then closes its side of the connection with There's a couple of things that come to mind:
|
I guess the 5 seconds comes from: https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_server_keepalivetimeout. Default node server keepalive timeout. You may want to tweak node/elb timeout settings to arrive at something more harmonious. |
@mtharrison thanks, I try it. |
Is there keepalive timeout setting in hapi options ? https://hapijs.com/api/16.6.2#serverconnections |
This is related, same issue described as you: nodejs/node#17749. Are you on Node 8? I think node 8 changed timeout from 2min to 5s. If you wanted the old behaviour you'd do something like: const Hapi = require('hapi');
const server = Hapi.server({ port: ... });
server.listener.keepAliveTimeout = 120e3;
.... |
We've been having intermittent 502s since node 8 as well, so it was interesting to see this issue. I was able to repro this with a similar configuration in Azure and a loop of POST requests running every 5.01 seconds. I applied @mtharrison's keepAliveTimeout as above and am no longer able to repro the FIN and resulting 502 from the LB. Thanks! |
solved. thanks! |
Here's my own experience with this new situation: nodejs/node#20256 |
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
Detail
I use hapi as an API server on AWS EC2.
Load Balancer returns 502 error several times a day.
When I looked at the TCP stream, I received a POST request with
FIN-WAIT 1
state and it seems that it is getting a 502 error because it returnsRST
.I was told from AWS Technical Support "Does Node.js properly implement closing processing for requests?" However, how can I properly perform close processing with hapi?
TCP dump
Code
Request Flow
Application Load Balanser -> EC2 ( Node.js on hapi at 3000 port)
Environment
Relation issue ?
##3480
The text was updated successfully, but these errors were encountered: