Adar Dembo has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/9810 )
Change subject: KUDU-2377: cap GetResourceLimit return value at kint32max ...................................................................... KUDU-2377: cap GetResourceLimit return value at kint32max Resource limits on UNIX are 64-bit unsigned integers but we mistreat them: 1. GetResourceLimit returns the underlying unsigned long as a int64_t. 2. The values may be further truncated into 32-bit integers. For example, the LogBlockManager constructor truncates a int64_t value derived from the resource limit into a 32-bit integer when constructing its FileCache. Here's a simple workaround: let's enforce that the returned resource limit value never exceeds kint32max. Sure, that misrepresents the underlying system limit, but for the resources we currently define (max open files and max threads per euid), it's impossible to actually use that much. I manually tested this by running several unit tests in a root shell with ulimit -u set to some high values (2^32-1 and 2^32-2). Change-Id: I0d30ebd5447867d4227974e64786cc48fdbf2688 Reviewed-on: http://gerrit.cloudera.org:8080/9810 Tested-by: Kudu Jenkins Reviewed-by: Grant Henke <[email protected]> Reviewed-by: Todd Lipcon <[email protected]> --- M src/kudu/util/env.h M src/kudu/util/env_posix.cc 2 files changed, 8 insertions(+), 1 deletion(-) Approvals: Kudu Jenkins: Verified Grant Henke: Looks good to me, but someone else must approve Todd Lipcon: Looks good to me, approved -- To view, visit http://gerrit.cloudera.org:8080/9810 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I0d30ebd5447867d4227974e64786cc48fdbf2688 Gerrit-Change-Number: 9810 Gerrit-PatchSet: 3 Gerrit-Owner: Adar Dembo <[email protected]> Gerrit-Reviewer: Adar Dembo <[email protected]> Gerrit-Reviewer: Grant Henke <[email protected]> Gerrit-Reviewer: Kudu Jenkins Gerrit-Reviewer: Todd Lipcon <[email protected]>
