Skip to content

Commit

Permalink
test_rlimit fails on MacOSX (#7457)
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky authored Jan 10, 2023
1 parent a80a3fa commit 6dd3c70
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion distributed/tests/test_stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,14 @@ def vsum(*args):
return sum(args)


@pytest.mark.skip(reason="times out")
@pytest.mark.avoid_ci
@pytest.mark.slow
@gen_cluster(client=True, nthreads=[("127.0.0.1", 1)] * 80)
async def test_stress_communication(c, s, *workers):
s.validate = False # very slow otherwise
for w in workers:
w.validate = False
w.state.validate = False
da = pytest.importorskip("dask.array")
# Test consumes many file descriptors and can hang if the limit is too low
resource = pytest.importorskip("resource")
Expand Down
13 changes: 8 additions & 5 deletions distributed/tests/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import psutil
import pytest

from distributed.compatibility import MACOS
from distributed.system import memory_limit


Expand Down Expand Up @@ -87,13 +88,15 @@ def myopen(path, *args, **kwargs):
assert limit == 10


@pytest.mark.xfail(
MACOS,
reason="Mac OS raises 'ValueError: current limit exceeds maximum limit' "
"when calling setrlimit with as little as 7 GiB (getrlimit returns 2**63)",
)
def test_rlimit():
resource = pytest.importorskip("resource")

# decrease memory limit by one byte
new_limit = memory_limit() - 1
try:
resource.setrlimit(resource.RLIMIT_RSS, (new_limit, new_limit))
assert memory_limit() == new_limit
except OSError:
pytest.skip("resource could not set the RSS limit")
resource.setrlimit(resource.RLIMIT_RSS, (new_limit, new_limit))
assert memory_limit() == new_limit
2 changes: 1 addition & 1 deletion distributed/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,7 @@ def bump_rlimit(limit, desired):
try:
soft, hard = resource.getrlimit(limit)
if soft < desired:
resource.setrlimit(limit, (desired, max(hard, desired)))
resource.setrlimit(limit, (desired, min(hard, desired)))
except Exception as e:
pytest.skip(f"rlimit too low ({soft}) and can't be increased: {e}")

Expand Down

0 comments on commit 6dd3c70

Please sign in to comment.