You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Joe McDonnell (Code Review)" <ge...@cloudera.org> on 2018/02/16 23:20:46 UTC
[kudu-CR] KUDU-2305: Fix local variable usage to handle 2GB messages
Joe McDonnell has uploaded this change for review. ( http://gerrit.cloudera.org:8080/9355
Change subject: KUDU-2305: Fix local variable usage to handle 2GB messages
......................................................................
KUDU-2305: Fix local variable usage to handle 2GB messages
The maximum value for rpc_max_message_size (an int32_t) is
INT_MAX. However, when using this maximum value, certain
local variables in SerializeMessage() and InboundTransfer
can overflow if the message size approaches INT_MAX.
This changes certain variables to handle messages that
approach INT_MAX. Specifically:
- Local variables in SerializeMessage() become uint32_t
rather than int.
- The total message size prefixed to the message is now
treated as a uint32_t everywhere. This impacts
InboundTransfer::total_length_/cur_offset_ and
a local variable in ParseMessage().
These changes mean that a sender can serialize a message
that is slightly larger than INT_MAX due to the added
header size, but the receiver will reject all messages
exceeding rpc_max_message_size (maximum INT_MAX).
For testing, this modifies rpc-test's TestRpcSidecarLimits
to send a message of size INT_MAX rather than
rpc_max_message_size+1.
Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
---
M src/kudu/rpc/rpc-test.cc
M src/kudu/rpc/serialization.cc
M src/kudu/rpc/transfer.cc
M src/kudu/rpc/transfer.h
4 files changed, 15 insertions(+), 8 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/55/9355/1
--
To view, visit http://gerrit.cloudera.org:8080/9355
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
Gerrit-Change-Number: 9355
Gerrit-PatchSet: 1
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
[kudu-CR] KUDU-2305: Fix local variable usage to handle 2GB messages
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has posted comments on this change. ( http://gerrit.cloudera.org:8080/9355 )
Change subject: KUDU-2305: Fix local variable usage to handle 2GB messages
......................................................................
Patch Set 1:
(5 comments)
- Switched to using int64_t.
- ASAN requires explicit casts in the serialization code, so I added those.
- Modified rpc-test to avoid the git tidy issue. (There is a different way to fix it if that is desired.)
http://gerrit.cloudera.org:8080/#/c/9355/1//COMMIT_MSG
Commit Message:
http://gerrit.cloudera.org:8080/#/c/9355/1//COMMIT_MSG@16
PS1, Line 16: - Local variables in SerializeMessage() become uint32_t
: rather than int.
> what about just using int64 for the variables? we try not to use unsigneds
Fixed
http://gerrit.cloudera.org:8080/#/c/9355/1//COMMIT_MSG@26
PS1, Line 26: exceeding rpc_max_message_size (maximum INT_MAX).
> should we add validation to the flag to ensure that it isn't set to any val
If I'm understanding it correctly, I think the enforcement of rpc_max_message_size in InboundTransfer::ReceieveBuffer() is doing what we want. For a N byte message, the first 4 bytes are the size (which doesn't include itself, so is N-4). We add back the 4 bytes and do the check. If N > rpc_max_message_size, it will be rejected. So, even rpc_max_message_size = INT_MAX should be enforced correctly.
A sender can't successfully send a rpc_max_message_size payload due to the added header (50ish bytes).
http://gerrit.cloudera.org:8080/#/c/9355/1/src/kudu/rpc/rpc-test.cc
File src/kudu/rpc/rpc-test.cc:
http://gerrit.cloudera.org:8080/#/c/9355/1/src/kudu/rpc/rpc-test.cc@646
PS1, Line 646: string s(INT_MAX, 'a');
> warning: suspicious large length parameter [misc-string-constructor]
Bypassed this by doing a resize.
An alternative fix is to modify src/kudu/.clang_tidy to add this line (which disables the check for large string initialization):
- key: misc-string-constructor.WarnOnLargeLength
value: 0
http://gerrit.cloudera.org:8080/#/c/9355/1/src/kudu/rpc/serialization.cc
File src/kudu/rpc/serialization.cc:
http://gerrit.cloudera.org:8080/#/c/9355/1/src/kudu/rpc/serialization.cc@59
PS1, Line 59: // KUDU-2305: Use unsigned 4-byte integers to avoid overflowing when additional_size
> this sort of makes it sound like you're pointing out an existing bug instea
Makes sense. Fixed.
http://gerrit.cloudera.org:8080/#/c/9355/1/src/kudu/rpc/serialization.cc@120
PS1, Line 120: DCHECK_EQ(total_len + kMsgLengthPrefixLength, buf.size())
> maybe safer here to subtract from buf.size rather than add to total_len, so
Fixed.
--
To view, visit http://gerrit.cloudera.org:8080/9355
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
Gerrit-Change-Number: 9355
Gerrit-PatchSet: 1
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Dan Burkert <da...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Comment-Date: Mon, 19 Feb 2018 20:31:51 +0000
Gerrit-HasComments: Yes
[kudu-CR] KUDU-2305: Fix local variable usage to handle 2GB messages
Posted by "Michael Ho (Code Review)" <ge...@cloudera.org>.
Michael Ho has posted comments on this change. ( http://gerrit.cloudera.org:8080/9355 )
Change subject: KUDU-2305: Fix local variable usage to handle 2GB messages
......................................................................
Patch Set 3:
Ping. Impala also needs this patch once this is merged on Kudu side.
--
To view, visit http://gerrit.cloudera.org:8080/9355
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
Gerrit-Change-Number: 9355
Gerrit-PatchSet: 3
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Dan Burkert <da...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Comment-Date: Thu, 22 Feb 2018 04:34:02 +0000
Gerrit-HasComments: No
[kudu-CR] KUDU-2305: Fix local variable usage to handle 2GB messages
Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change. ( http://gerrit.cloudera.org:8080/9355 )
Change subject: KUDU-2305: Fix local variable usage to handle 2GB messages
......................................................................
Patch Set 3: Code-Review+1
(1 comment)
Would be good for Dan B to take a look at this as our resident int overflow detective
http://gerrit.cloudera.org:8080/#/c/9355/3/src/kudu/rpc/serialization.cc
File src/kudu/rpc/serialization.cc:
http://gerrit.cloudera.org:8080/#/c/9355/3/src/kudu/rpc/serialization.cc@61
PS3, Line 61: static_cast<int64_t>(additional_size)
> Yes, I think only the first cast is necessary to fix the ASAN issue. This s
could go either way I guess. I often get confused by type promotion rules like this so I'm not against being explicit.
--
To view, visit http://gerrit.cloudera.org:8080/9355
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
Gerrit-Change-Number: 9355
Gerrit-PatchSet: 3
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Dan Burkert <da...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Comment-Date: Tue, 20 Feb 2018 23:10:25 +0000
Gerrit-HasComments: Yes
[kudu-CR] KUDU-2305: Fix local variable usage to handle 2GB messages
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Hello Michael Ho, Tidy Bot, Dan Burkert, Kudu Jenkins, Todd Lipcon,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/9355
to look at the new patch set (#2).
Change subject: KUDU-2305: Fix local variable usage to handle 2GB messages
......................................................................
KUDU-2305: Fix local variable usage to handle 2GB messages
The maximum value for rpc_max_message_size (an int32_t) is
INT_MAX. However, when using this maximum value, certain
local variables in SerializeMessage() and InboundTransfer
can overflow if the message size approaches INT_MAX.
This changes certain variables to handle messages that
approach INT_MAX. Specifically:
- Local variables in SerializeMessage() become int64_t
rather than int.
- The total message size prefixed to the message is now
treated as a uint32_t everywhere. This impacts
InboundTransfer::total_length_/cur_offset_ and
a local variable in ParseMessage().
These changes mean that a sender can serialize a message
that is slightly larger than INT_MAX due to the added
header size, but the receiver will reject all messages
exceeding rpc_max_message_size (maximum INT_MAX).
For testing, this modifies rpc-test's TestRpcSidecarLimits
to send a message of size INT_MAX rather than
rpc_max_message_size+1. This increases the test runtime
from about 50ms to 2 seconds.
Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
---
M src/kudu/rpc/rpc-test.cc
M src/kudu/rpc/serialization.cc
M src/kudu/rpc/transfer.cc
M src/kudu/rpc/transfer.h
4 files changed, 18 insertions(+), 9 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/55/9355/2
--
To view, visit http://gerrit.cloudera.org:8080/9355
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
Gerrit-Change-Number: 9355
Gerrit-PatchSet: 2
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Dan Burkert <da...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
[kudu-CR] KUDU-2305: Fix local variable usage to handle 2GB messages
Posted by "Dan Burkert (Code Review)" <ge...@cloudera.org>.
Dan Burkert has posted comments on this change. ( http://gerrit.cloudera.org:8080/9355 )
Change subject: KUDU-2305: Fix local variable usage to handle 2GB messages
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit http://gerrit.cloudera.org:8080/9355
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
Gerrit-Change-Number: 9355
Gerrit-PatchSet: 3
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Dan Burkert <da...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Comment-Date: Thu, 22 Feb 2018 20:52:23 +0000
Gerrit-HasComments: No
[kudu-CR] KUDU-2305: Fix local variable usage to handle 2GB messages
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has posted comments on this change. ( http://gerrit.cloudera.org:8080/9355 )
Change subject: KUDU-2305: Fix local variable usage to handle 2GB messages
......................................................................
Patch Set 3:
Fix IWYU
--
To view, visit http://gerrit.cloudera.org:8080/9355
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
Gerrit-Change-Number: 9355
Gerrit-PatchSet: 3
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Dan Burkert <da...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Comment-Date: Mon, 19 Feb 2018 21:05:02 +0000
Gerrit-HasComments: No
[kudu-CR] KUDU-2305: Fix local variable usage to handle 2GB messages
Posted by "Michael Ho (Code Review)" <ge...@cloudera.org>.
Michael Ho has posted comments on this change. ( http://gerrit.cloudera.org:8080/9355 )
Change subject: KUDU-2305: Fix local variable usage to handle 2GB messages
......................................................................
Patch Set 3:
(2 comments)
http://gerrit.cloudera.org:8080/#/c/9355/3/src/kudu/rpc/serialization.cc
File src/kudu/rpc/serialization.cc:
http://gerrit.cloudera.org:8080/#/c/9355/3/src/kudu/rpc/serialization.cc@61
PS3, Line 61: static_cast<int64_t>(additional_size)
Won't this be automatically promoted to int64_t ? Is this second cast needed ? Same below.
http://gerrit.cloudera.org:8080/#/c/9355/3/src/kudu/rpc/transfer.cc
File src/kudu/rpc/transfer.cc:
http://gerrit.cloudera.org:8080/#/c/9355/3/src/kudu/rpc/transfer.cc@81
PS3, Line 81: kMsgLengthPrefixLength
Does it make sense to to DCHECK_LE(kMsgLengthPrefixLength, INT_MAX) or in theory, this may overflow rem here too.
--
To view, visit http://gerrit.cloudera.org:8080/9355
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
Gerrit-Change-Number: 9355
Gerrit-PatchSet: 3
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Dan Burkert <da...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Comment-Date: Tue, 20 Feb 2018 03:17:03 +0000
Gerrit-HasComments: Yes
[kudu-CR] KUDU-2305: Fix local variable usage to handle 2GB messages
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Hello Michael Ho, Tidy Bot, Dan Burkert, Kudu Jenkins, Todd Lipcon,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/9355
to look at the new patch set (#3).
Change subject: KUDU-2305: Fix local variable usage to handle 2GB messages
......................................................................
KUDU-2305: Fix local variable usage to handle 2GB messages
The maximum value for rpc_max_message_size (an int32_t) is
INT_MAX. However, when using this maximum value, certain
local variables in SerializeMessage() and InboundTransfer
can overflow if the message size approaches INT_MAX.
This changes certain variables to handle messages that
approach INT_MAX. Specifically:
- Local variables in SerializeMessage() become int64_t
rather than int.
- The total message size prefixed to the message is now
treated as a uint32_t everywhere. This impacts
InboundTransfer::total_length_/cur_offset_ and
a local variable in ParseMessage().
These changes mean that a sender can serialize a message
that is slightly larger than INT_MAX due to the added
header size, but the receiver will reject all messages
exceeding rpc_max_message_size (maximum INT_MAX).
For testing, this modifies rpc-test's TestRpcSidecarLimits
to send a message of size INT_MAX rather than
rpc_max_message_size+1. This increases the test runtime
from about 50ms to 2 seconds.
Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
---
M src/kudu/rpc/rpc-test.cc
M src/kudu/rpc/serialization.cc
M src/kudu/rpc/transfer.cc
M src/kudu/rpc/transfer.h
4 files changed, 19 insertions(+), 9 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/55/9355/3
--
To view, visit http://gerrit.cloudera.org:8080/9355
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
Gerrit-Change-Number: 9355
Gerrit-PatchSet: 3
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Dan Burkert <da...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
[kudu-CR] KUDU-2305: Fix local variable usage to handle 2GB messages
Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change. ( http://gerrit.cloudera.org:8080/9355 )
Change subject: KUDU-2305: Fix local variable usage to handle 2GB messages
......................................................................
Patch Set 1:
(4 comments)
http://gerrit.cloudera.org:8080/#/c/9355/1//COMMIT_MSG
Commit Message:
http://gerrit.cloudera.org:8080/#/c/9355/1//COMMIT_MSG@16
PS1, Line 16: - Local variables in SerializeMessage() become uint32_t
: rather than int.
what about just using int64 for the variables? we try not to use unsigneds when possible
http://gerrit.cloudera.org:8080/#/c/9355/1//COMMIT_MSG@26
PS1, Line 26: exceeding rpc_max_message_size (maximum INT_MAX).
should we add validation to the flag to ensure that it isn't set to any value larger than INT_MAX-4 or whatever the true maximum is?
http://gerrit.cloudera.org:8080/#/c/9355/1/src/kudu/rpc/serialization.cc
File src/kudu/rpc/serialization.cc:
http://gerrit.cloudera.org:8080/#/c/9355/1/src/kudu/rpc/serialization.cc@59
PS1, Line 59: // KUDU-2305: Use unsigned 4-byte integers to avoid overflowing when additional_size
this sort of makes it sound like you're pointing out an existing bug instead of documenting that the fix is related to this JIRA. I think better to not reference the JIRA and if someone is confused they can find the JIRA via git blame
http://gerrit.cloudera.org:8080/#/c/9355/1/src/kudu/rpc/serialization.cc@120
PS1, Line 120: DCHECK_EQ(total_len + kMsgLengthPrefixLength, buf.size())
maybe safer here to subtract from buf.size rather than add to total_len, so it can't overflow even if the caller sends UINT32_MAX
--
To view, visit http://gerrit.cloudera.org:8080/9355
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
Gerrit-Change-Number: 9355
Gerrit-PatchSet: 1
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Comment-Date: Fri, 16 Feb 2018 23:27:09 +0000
Gerrit-HasComments: Yes
[kudu-CR] KUDU-2305: Fix local variable usage to handle 2GB messages
Posted by "Joe McDonnell (Code Review)" <ge...@cloudera.org>.
Joe McDonnell has posted comments on this change. ( http://gerrit.cloudera.org:8080/9355 )
Change subject: KUDU-2305: Fix local variable usage to handle 2GB messages
......................................................................
Patch Set 3:
(2 comments)
http://gerrit.cloudera.org:8080/#/c/9355/3/src/kudu/rpc/serialization.cc
File src/kudu/rpc/serialization.cc:
http://gerrit.cloudera.org:8080/#/c/9355/3/src/kudu/rpc/serialization.cc@61
PS3, Line 61: static_cast<int64_t>(additional_size)
> Won't this be automatically promoted to int64_t ? Is this second cast neede
Yes, I think only the first cast is necessary to fix the ASAN issue. This seems like a code style thing, so I thought I'd let the Kudu guys comment. I don't have a preference.
http://gerrit.cloudera.org:8080/#/c/9355/3/src/kudu/rpc/transfer.cc
File src/kudu/rpc/transfer.cc:
http://gerrit.cloudera.org:8080/#/c/9355/3/src/kudu/rpc/transfer.cc@81
PS3, Line 81: kMsgLengthPrefixLength
> Does it make sense to to DCHECK_LE(kMsgLengthPrefixLength, INT_MAX) or in t
kMsgLengthPrefixLength is a uint8_t and is always 4, so rem is always a small number.
The comment right above this is confusing. I'll see if I can make it clearer.
--
To view, visit http://gerrit.cloudera.org:8080/9355
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
Gerrit-Change-Number: 9355
Gerrit-PatchSet: 3
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Dan Burkert <da...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Comment-Date: Tue, 20 Feb 2018 17:24:39 +0000
Gerrit-HasComments: Yes
[kudu-CR] KUDU-2305: Fix local variable usage to handle 2GB messages
Posted by "Dan Burkert (Code Review)" <ge...@cloudera.org>.
Dan Burkert has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/9355 )
Change subject: KUDU-2305: Fix local variable usage to handle 2GB messages
......................................................................
KUDU-2305: Fix local variable usage to handle 2GB messages
The maximum value for rpc_max_message_size (an int32_t) is
INT_MAX. However, when using this maximum value, certain
local variables in SerializeMessage() and InboundTransfer
can overflow if the message size approaches INT_MAX.
This changes certain variables to handle messages that
approach INT_MAX. Specifically:
- Local variables in SerializeMessage() become int64_t
rather than int.
- The total message size prefixed to the message is now
treated as a uint32_t everywhere. This impacts
InboundTransfer::total_length_/cur_offset_ and
a local variable in ParseMessage().
These changes mean that a sender can serialize a message
that is slightly larger than INT_MAX due to the added
header size, but the receiver will reject all messages
exceeding rpc_max_message_size (maximum INT_MAX).
For testing, this modifies rpc-test's TestRpcSidecarLimits
to send a message of size INT_MAX rather than
rpc_max_message_size+1. This increases the test runtime
from about 50ms to 2 seconds.
Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
Reviewed-on: http://gerrit.cloudera.org:8080/9355
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <to...@apache.org>
Reviewed-by: Dan Burkert <da...@cloudera.com>
---
M src/kudu/rpc/rpc-test.cc
M src/kudu/rpc/serialization.cc
M src/kudu/rpc/transfer.cc
M src/kudu/rpc/transfer.h
4 files changed, 19 insertions(+), 9 deletions(-)
Approvals:
Kudu Jenkins: Verified
Todd Lipcon: Looks good to me, but someone else must approve
Dan Burkert: Looks good to me, approved
--
To view, visit http://gerrit.cloudera.org:8080/9355
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8e468099b16f7eb55de71b753acae8f57d18287c
Gerrit-Change-Number: 9355
Gerrit-PatchSet: 4
Gerrit-Owner: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Dan Burkert <da...@cloudera.com>
Gerrit-Reviewer: Joe McDonnell <jo...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Michael Ho <kw...@cloudera.com>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>