-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
http2: fix stream reading resumption #16580
Conversation
CI failed on a whole bunch of systems. Not really sure why, will investigate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Ok, this has been updated. Anyone that approved, PTAL. resumption in This is a similar issue to one that plagued the compatibility API _read for a while and the fix there was the same. (Also, performance on reads appears unaffected — possibly 1.5-2% better.) |
Still LGTM |
e340ac0
to
2d76c4f
Compare
+1 for fast tracking this for the 9.0.0 release. |
I'll get this merged into master as soon as CI comes back green, unless there are any objections. |
appears to have failed on freebsd |
Yep, I just saw. Looking into it. |
Setting up a freebsd box to test on. I would still like this to make 9.0.0 because it's a pretty significant bug fix but it might take me an hour or two to diagnose and fix. |
Just a flaky test, it looks like. I changed it to compare the length of the buffer and it works fine. Here's the FreeBSD CI: https://ci.nodejs.org/job/node-test-commit-freebsd/12804/ (all green) |
Stress test on FreeBSD to make sure: https://ci.nodejs.org/job/node-stress-single-test/1473/ |
Just an FYI, if that's all green then this is going to master. ping @jasnell — you ok with that? |
Ok, stress test on FreeBSD failed. This seems pretty serious since it's emitting |
hmmm... let's see if we can get it fixed today. If not, we can land this as is, mark that test flaky on freebsd, and keep working on fixing it. That way we can make sure that it is at least working on most platforms. |
Yeah, that seems sensible. Thought I had it but latest commit still didn't do it for FreeBSD. Tricky one... will keep this PR updated with my progress. |
_read should always resume the underlying code that is attempting to push data to a readable stream. Adjust http2 core code to resume its reading appropriately. Fixes: nodejs#16578
_read should always resume the underlying code that is attempting to push data to a readable stream. Adjust http2 core code to resume its reading appropriately. Some other general cleanup around reading, resuming & draining. PR-URL: #16580 Fixes: #16578 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Awesome work @apapirovski 🖤 |
@jasnell some additional debugging output from nghttp2:
I mean, no wonder it's failing given "recv: length is too large 7302178 > 16384"... but now the question is 'why' in the world is the payloadlen so large. |
_read should always resume the underlying code that is attempting to push data to a readable stream. Adjust http2 core code to resume its reading appropriately. Some other general cleanup around reading, resuming & draining. PR-URL: #16580 Fixes: #16578 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
@jasnell So I now have a cause for that FreeBSD bug, it looks like the data at the buffer pointer passed into |
Is the test case using tls or plain text? |
if plain text, switch it to use tls and see if you have the same problem |
No issue with TLS. It copies the data itself, doesn't it? (I think that's rhetorical based on my reading of the source... 😅) |
Yep, that's the confirmation I was looking for. So it would appear that on freebsd we have a race condition happening. There is only a single outbound buffer allocated, and each write is supposed to happen sequentially, but on freebsd it's holding on to the buffer a bit longer. That definitely gives us a starting point to begin poking. I'm going to be working on some refactoring of that part of the code anyway as soon as I can be done preparing the 9.0.0 release (which is what was taking up my time this weekend instead of helping debugging this so I appreciate the time you were taking on it). |
Was happy to look into it. Got a good feel for nghttp2 and most of the http2 code after doing this. |
Awesome. Yeah I've never really been that happy with the data flow through that part of the implementation. It needs a refactor to avoid the memcpy's to improve the callback story. I've already been looking into it and will hopefully have something very soon. |
_read should always resume the underlying code that is attempting to push data to a readable stream. Adjust http2 core code to resume its reading appropriately. Some other general cleanup around reading, resuming & draining. PR-URL: #16580 Fixes: #16578 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
_read should always resume the underlying code that is attempting to push data to a readable stream. Adjust http2 core code to resume its reading appropriately. Some other general cleanup around reading, resuming & draining. PR-URL: #16580 Fixes: #16578 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
_read should always resume the underlying code that is attempting to push data to a readable stream. Adjust http2 core code to resume its reading appropriately. Some other general cleanup around reading, resuming & draining. PR-URL: #16580 Fixes: #16578 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
_read should always resume the underlying code that is attempting to push data to a readable stream. Adjust http2 core code to resume its reading appropriately. Some other general cleanup around reading, resuming & draining. PR-URL: nodejs/node#16580 Fixes: nodejs/node#16578 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
_read should always resume the underlying code that is attempting to push data to a readable stream. Adjust http2 core code to resume its reading appropriately. Some other general cleanup around reading, resuming & draining. PR-URL: nodejs/node#16580 Fixes: nodejs/node#16578 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
_read should always resume the underlying code that is attempting to push data to a readable stream. Adjust http2 core code to resume its reading appropriately. Some other general cleanup around reading, resuming & draining. PR-URL: nodejs/node#16580 Fixes: nodejs/node#16578 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
_read
should always resume the underlying code that is attempting to push data to a readable stream. Adjust http2 core code to resume its reading appropriately.Fixes: #16578
Refs: https://nodejs.org/dist/latest-v8.x/docs/api/stream.html#stream_readable_read_size_1
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
http2, test