Fix AIX bug for users with unlimited nofiles #41
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using pexpect on AIX, I encountered a bug where os.close() in openpty would hang when running under particular user accounts which had nofiles ulimit set to unlimited. After tracing, it appears that resource.RLIMIT_NOFILE for these users is 2^63-1, and os.closerange() was attempting to close a huge number of fds. Putting an arbitrary ceiling on max_fds resolves the issue. Feel free to increase/lower ceiling as desired, or put under an AIX OS check to further isolate.