-
Notifications
You must be signed in to change notification settings - Fork 30k
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
src: add method to compute storage in WriteWrap #16727
Conversation
`WriteWrap` instances may contain extra storage space. `self_size()` returns the size of the *entire* struct, member fields as well as storage space, so it is not an accurate measure for the storage space available. Add a method `ExtraSize()` (like the existing `Extra()` for accessing the storage memory) that yields the wanted value, and use it in the HTTP2 impl to fix a crash. Ref: nodejs#16669
Lgtm... Thanks for catching |
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.
Should land soon to unbreak the CI
Looks like the fix is good, just waiting on CI to finish then will get it landed (CI is a bit bound up by a couple prior tests, taking longer than it should) |
Ci is green, landing |
`WriteWrap` instances may contain extra storage space. `self_size()` returns the size of the *entire* struct, member fields as well as storage space, so it is not an accurate measure for the storage space available. Add a method `ExtraSize()` (like the existing `Extra()` for accessing the storage memory) that yields the wanted value, and use it in the HTTP2 impl to fix a crash. PR-URL: #16727 Refs: #16669 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
`WriteWrap` instances may contain extra storage space. `self_size()` returns the size of the *entire* struct, member fields as well as storage space, so it is not an accurate measure for the storage space available. Add a method `ExtraSize()` (like the existing `Extra()` for accessing the storage memory) that yields the wanted value, and use it in the HTTP2 impl to fix a crash. PR-URL: nodejs#16727 Refs: nodejs#16669 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
@addaleax conflicts for v8.x, mind raising a backport? diff --cc src/node_http2_core-inl.h
index fa365fee05,c78e5d673f..0000000000
--- a/src/node_http2_core-inl.h
+++ b/src/node_http2_core-inl.h
@@@ -501,6 -501,11 +501,20 @@@ inline void Nghttp2Session::SendPending
// While srcLength is greater than zero
while ((srcLength = nghttp2_session_mem_send(session_, &src)) > 0) {
++<<<<<<< HEAD
++||||||| parent of a5f3b3a6da... src: add method to compute storage in WriteWrap
++ if (req == nullptr) {
++ req = AllocateSend();
++ destRemaining = req->self_size();
++ dest = req->Extra();
++ }
++=======
+ if (req == nullptr) {
+ req = AllocateSend();
+ destRemaining = req->ExtraSize();
+ dest = req->Extra();
+ }
++>>>>>>> a5f3b3a6da... src: add method to compute storage in WriteWrap
DEBUG_HTTP2("Nghttp2Session %s: nghttp2 has %d bytes to send\n",
TypeName(), srcLength);
size_t srcRemaining = srcLength;
@@@ -519,7 -524,9 +533,17 @@@
destLength = 0;
srcRemaining -= destRemaining;
srcOffset += destRemaining;
++<<<<<<< HEAD
+ destRemaining = dest.len;
++||||||| parent of a5f3b3a6da... src: add method to compute storage in WriteWrap
++ req = AllocateSend();
++ destRemaining = req->self_size();
++ dest = req->Extra();
++=======
+ req = AllocateSend();
+ destRemaining = req->ExtraSize();
+ dest = req->Extra();
++>>>>>>> a5f3b3a6da... src: add method to compute storage in WriteWrap
}
if (srcRemaining > 0) {
|
`WriteWrap` instances may contain extra storage space. `self_size()` returns the size of the *entire* struct, member fields as well as storage space, so it is not an accurate measure for the storage space available. Add a method `ExtraSize()` (like the existing `Extra()` for accessing the storage memory) that yields the wanted value, and use it in the HTTP2 impl to fix a crash. PR-URL: #16727 Refs: #16669 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
`WriteWrap` instances may contain extra storage space. `self_size()` returns the size of the *entire* struct, member fields as well as storage space, so it is not an accurate measure for the storage space available. Add a method `ExtraSize()` (like the existing `Extra()` for accessing the storage memory) that yields the wanted value, and use it in the HTTP2 impl to fix a crash. PR-URL: #16727 Refs: #16669 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
WriteWrap
instances may contain extra storage space.self_size()
returns the size of the entire struct, member fields aswell as storage space, so it is not an accurate measure for the
storage space available.
Add a method
ExtraSize()
(like the existingExtra()
for accessingthe storage memory) that yields the wanted value, and use it
in the HTTP2 impl to fix a crash.
Ref: #16669
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
http2
@nodejs/http2 @jasnell Probably want to fast-track this :)