CleanCut / green

Green is a clean, colorful, fast python test runner.
MIT License
793 stars 75 forks source link

running green -vvv green.test.test_runner on PyPy + macOS errors out #265

Closed mattip closed 1 year ago

mattip commented 1 year ago

Reviewing old issues on the PyPy issue tracker I came across this where running green -vvv green.test.test_runner would crash when run with PyPy. The report is old, so I tried re-running on a more current PyPy on a macOS M1 machine using pypy3.8-v7.3.9 in x86_64 mode. I now consistently get this error about too many open files:

Traceback ``` Traceback (most recent call last): File "/Users/matti/oss/pypy3.7-v7.3.9-osx64/lib-python/3/multiprocessing/process.py", line 297, in _bootstrap File "/Users/matti/oss/pypy3.7-v7.3.9-osx64/lib-python/3/multiprocessing/process.py", line 99, in run File "/Users/matti/oss/pypy3.7-v7.3.9-osx64/lib-python/3/multiprocessing/managers.py", line 597, in _run_server server.serve_forever() File "/Users/matti/oss/pypy3.7-v7.3.9-osx64/lib-python/3/multiprocessing/managers.py", line 173, in serve_forever sys.exit(0) SystemExit: 0 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/matti/oss/pypy3.7-v7.3.9-osx64/lib-python/3/multiprocessing/util.py", line 300, in _run_finalizers File "/Users/matti/oss/pypy3.7-v7.3.9-osx64/lib-python/3/multiprocessing/util.py", line 224, in __call__ File "/Users/matti/oss/pypy3.7-v7.3.9-osx64/lib-python/3/multiprocessing/util.py", line 133, in _remove_temp_dir File "/Users/matti/oss/pypy3.7-v7.3.9-osx64/lib-python/3/shutil.py", line 490, in rmtree File "/Users/matti/oss/pypy3.7-v7.3.9-osx64/lib-python/3/shutil.py", line 488, in rmtree OSError: [Errno 24] Too many open files: '/var/folders/4r/67pc2qss79q97y_7jpftm8tw0000gn/T/tmpgyjzia78/pymp-ee2_t_e2' ```

Setting ulimit -n 30000 "solves" the problem and the test suite reports no errors. Is there a place where the tests are opening files without explicitly closing them?

CleanCut commented 1 year ago

Hmmm...I've looked through the tests and I cannot find any place that leaves open file handles, which isn't particularly surprising because if the tests left open file handles, I would expect many platforms would have problems. 😆

I don't know why PyPy in x86_64 mode in Rosetta on an M1 has problems...but I don't think it's green's fault, and that's an exotic-enough setup that I'm not planning on looking into it any further.

If you can reproduce the problem with pypy 3.8 or 3.9 with the MacOS arm64 downloads on the M1, feel free to reopen this and I'll take another look! 😄

mattip commented 1 year ago

OK, thanks for looking. I closed the PyPy issue, let's see if someone reopens or opens a new one.