Skip to content

Commit

Permalink
issue #549: ansible: reduce risk by capping RLIM_INFINITY
Browse files Browse the repository at this point in the history
  • Loading branch information
dw committed Aug 3, 2019
1 parent 7ca2d00 commit edde251
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ansible_mitogen/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,14 @@ def increase_open_file_limit():
limit is much higher.
"""
soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
LOG.debug('inherited open file limits: soft=%d hard=%d', soft, hard)
if hard == resource.RLIM_INFINITY:
hard_s = '(infinity)'
# cap in case of O(RLIMIT_NOFILE) algorithm in some subprocess.
hard = 524288
else:
hard_s = str(hard)

LOG.debug('inherited open file limits: soft=%d hard=%s', soft, hard_s)
if soft >= hard:
LOG.debug('max open files already set to hard limit: %d', hard)
return
Expand Down

0 comments on commit edde251

Please sign in to comment.