Adar Dembo has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/9821 )

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]>
(cherry picked from commit 17aceda39d486a8f3ed6ddf5ae0e32611154a5ef)
Reviewed-on: http://gerrit.cloudera.org:8080/9821
Tested-by: Adar Dembo <[email protected]>
---
M src/kudu/util/env.h
M src/kudu/util/env_posix.cc
2 files changed, 8 insertions(+), 1 deletion(-)

Approvals:
  Grant Henke: Looks good to me, approved
  Adar Dembo: Verified

--
To view, visit http://gerrit.cloudera.org:8080/9821
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: branch-1.7.x
Gerrit-MessageType: merged
Gerrit-Change-Id: I0d30ebd5447867d4227974e64786cc48fdbf2688
Gerrit-Change-Number: 9821
Gerrit-PatchSet: 2
Gerrit-Owner: Adar Dembo <[email protected]>
Gerrit-Reviewer: Adar Dembo <[email protected]>
Gerrit-Reviewer: Grant Henke <[email protected]>
Gerrit-Reviewer: Kudu Jenkins

Reply via email to