Skip to content

http: wait for both prefinish/end to keepalive - #7149

Closed
indutny wants to merge 1 commit into
nodejs:masterfrom
indutny:fix/agent-keepalive-on-pending
Closed

http: wait for both prefinish/end to keepalive#7149
indutny wants to merge 1 commit into
nodejs:masterfrom
indutny:fix/agent-keepalive-on-pending

Conversation

@indutny

@indutnyindutny commented Jun 4, 2016

Copy link
Copy Markdown
Member
Checklist
  • tests and code linting passes
  • a test and/or benchmark is included
  • documentation is changed or added
  • the commit message follows commit guidelines
Affected core subsystem(s)
Description of change

When freeing the socket to be reused in keep-alive Agent wait for both
prefinish and end events. Otherwise the next request may be written
before the previous one has finished sending the body, leading to a
parser errors.

R= @nodejs/http

@nodejs-github-botnodejs-github-bot added the http Issues or PRs related to the http subsystem. label Jun 4, 2016
When `free`ing the socket to be reused in keep-alive Agent wait for both
`prefinish` and `end` events. Otherwise the next request may be written
before the previous one has finished sending the body, leading to a
parser errors.
@indutny
indutnyforce-pushed the fix/agent-keepalive-on-pending branch from b2a1b5c to 492bddeCompareJune 4, 2016 04:04
@indutny

Copy link
Copy Markdown
MemberAuthor

@indutny

Copy link
Copy Markdown
MemberAuthor

cc @nodejs/collaborators

@mcollina

Copy link
Copy Markdown
Member

LGTM

* `something`, and the client thought that this is a green light for sending
* next GET request
*/
post.write(Buffer.alloc(16 * 1024).fill('X'));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fwiw, this can be shortened to just Buffer.alloc(16 * 1024, 'X')

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ack.

@jasnell

Copy link
Copy Markdown
Member

LGTM

@indutny

Copy link
Copy Markdown
MemberAuthor

Landed in 1004ece, thank you!

@indutnyindutny closed this Jun 6, 2016
@indutny
indutny deleted the fix/agent-keepalive-on-pending branch June 6, 2016 17:34
indutny added a commit that referenced this pull request Jun 6, 2016
When `free`ing the socket to be reused in keep-alive Agent wait for
both `prefinish` and `end` events. Otherwise the next request may be
written before the previous one has finished sending the body, leading
to a parser errors.
PR-URL: #7149
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request Jun 15, 2016
When `free`ing the socket to be reused in keep-alive Agent wait for
both `prefinish` and `end` events. Otherwise the next request may be
written before the previous one has finished sending the body, leading
to a parser errors.
PR-URL: #7149
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas added a commit that referenced this pull request Jun 16, 2016
Notable changes:
* **http**:
- When maybeReadMore kicks in on a first bytes of incoming data, the
req.read(0) will be invoked and the `req._consuming` will be set to
true. This seemingly harmless property leads to a dire consequences:
the server won't call `req._dump()` and the whole HTTP/1.1 pipeline
will hang (single connection). (Fedor Indutny) [#7211](#7211)
- When freeing the socket to be reused in keep-alive Agent wait for
both prefinish and end events. Otherwise the next request may be
written before the previous one has finished sending the body, leading
to a parser errors. (Fedor Indutny) [#7149](#7149)
* **npm**: upgrade npm to 3.9.5 (Kat Marchán) [#7139](#7139)
@evanlucasevanlucas mentioned this pull request Jun 16, 2016
evanlucas added a commit that referenced this pull request Jun 16, 2016
Notable changes:
* **http**:
- req.read(0) could cause incoming connections to stall and time out
under certain conditions. (Fedor Indutny) [#7211](#7211)
- When freeing the socket to be reused in keep-alive Agent wait for
both prefinish and end events. Otherwise the next request may be
written before the previous one has finished sending the body, leading
to a parser errors. (Fedor Indutny) [#7149](#7149)
* **npm**: upgrade npm to 3.9.5 (Kat Marchán) [#7139](#7139)
#7323
evanlucas added a commit that referenced this pull request Jun 17, 2016
Notable changes:
* **http**:
- req.read(0) could cause incoming connections to stall and time out
under certain conditions. (Fedor Indutny) [#7211](#7211)
- When freeing the socket to be reused in keep-alive Agent wait for
both prefinish and end events. Otherwise the next request may be
written before the previous one has finished sending the body, leading
to a parser errors. (Fedor Indutny) [#7149](#7149)
* **npm**: upgrade npm to 3.9.5 (Kat Marchán) [#7139](#7139)
#7323
evanlucas added a commit that referenced this pull request Jun 17, 2016
Notable changes:
* **http**:
- req.read(0) could cause incoming connections to stall and time out
under certain conditions. (Fedor Indutny) [#7211](#7211)
- When freeing the socket to be reused in keep-alive Agent wait for
both prefinish and end events. Otherwise the next request may be
written before the previous one has finished sending the body, leading
to a parser errors. (Fedor Indutny) [#7149](#7149)
* **npm**: upgrade npm to 3.9.5 (Kat Marchán) [#7139](#7139)
PR-URL: #7323
@MylesBorins

Copy link
Copy Markdown
Contributor

@indutny lts?

@indutny

Copy link
Copy Markdown
MemberAuthor

@thealphanerd yes

MylesBorins pushed a commit that referenced this pull request Jul 11, 2016
When `free`ing the socket to be reused in keep-alive Agent wait for
both `prefinish` and `end` events. Otherwise the next request may be
written before the previous one has finished sending the body, leading
to a parser errors.
PR-URL: #7149
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jul 12, 2016
When `free`ing the socket to be reused in keep-alive Agent wait for
both `prefinish` and `end` events. Otherwise the next request may be
written before the previous one has finished sending the body, leading
to a parser errors.
PR-URL: #7149
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jul 12, 2016
When `free`ing the socket to be reused in keep-alive Agent wait for
both `prefinish` and `end` events. Otherwise the next request may be
written before the previous one has finished sending the body, leading
to a parser errors.
PR-URL: #7149
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorinsMylesBorins mentioned this pull request Jul 12, 2016
MylesBorins pushed a commit that referenced this pull request Jul 14, 2016
When `free`ing the socket to be reused in keep-alive Agent wait for
both `prefinish` and `end` events. Otherwise the next request may be
written before the previous one has finished sending the body, leading
to a parser errors.
PR-URL: #7149
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jul 14, 2016
When `free`ing the socket to be reused in keep-alive Agent wait for
both `prefinish` and `end` events. Otherwise the next request may be
written before the previous one has finished sending the body, leading
to a parser errors.
PR-URL: #7149
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

httpIssues or PRs related to the http subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@indutny@mcollina@jasnell@MylesBorins@nodejs-github-bot