[issue18963] test_selectors test_above_fd_setsize cases fail on OS X due to infinite hard limit

2013-09-08 Thread Charles-François Natali

Charles-François Natali added the comment:

 R. David Murray added the comment:

 See also issue issue 17409.

 The code isn't setting it to RLIM_INFINITY explicitly, though, so this must 
 mean that OSX is reporting an infinite hard limit when the hard limit is not 
 in fact infinite.  Seems like this is an OSX bug that we will have to work 
 around somehow.

Indeed.
I saw this while testing on custom buildbots, and opted for the
simplest solution: I added a @require_mac_version decorator, hoping
this would be solved in recent OSX versions. Apparently not :)

As a simple check, does the following work on OSX ?
 limit = resource.getrlimit(resource.RLIMIT_NOFILE)
 resource.setrlimit(resource.RLIMIT_NOFILE, limit)

Does the attached patch solve this?

--
keywords: +patch
Added file: http://bugs.python.org/file31660/selectors_osx.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18963
___diff -r 14972c999e80 Lib/test/test_selectors.py
--- a/Lib/test/test_selectors.pyFri Sep 06 21:12:22 2013 +0200
+++ b/Lib/test/test_selectors.pySun Sep 08 10:28:48 2013 +0200
@@ -301,7 +301,6 @@
 
 class ScalableSelectorMixIn:
 
-@support.requires_mac_ver(10, 5)
 @unittest.skipUnless(resource, Test needs resource module)
 def test_above_fd_setsize(self):
 # A scalable implementation should have no problem with more than
@@ -313,7 +312,7 @@
 self.addCleanup(resource.setrlimit, resource.RLIMIT_NOFILE,
 (soft, hard))
 NUM_FDS = hard
-except OSError:
+except (OSError, ValueError):
 NUM_FDS = soft
 
 # guard for already allocated FDs (stdin, stdout...)
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18963] test_selectors test_above_fd_setsize cases fail on OS X due to infinite hard limit

2013-09-08 Thread Ned Deily

Ned Deily added the comment:

As a simple check, does the following work on OSX ?
  limit = resource.getrlimit(resource.RLIMIT_NOFILE)
  resource.setrlimit(resource.RLIMIT_NOFILE, limit)

It doesn't produce an exception.

Does the attached patch solve this?

With the patch, test_selectors no longer fails.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18963
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18963] test_selectors test_above_fd_setsize cases fail on OS X due to infinite hard limit

2013-09-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9ba1432fdc5a by Charles-François Natali in branch 'default':
Issue #18963: Fix test_selectors.test_above_fd_setsize on OS X, where the
http://hg.python.org/cpython/rev/9ba1432fdc5a

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18963
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18963] test_selectors test_above_fd_setsize cases fail on OS X due to infinite hard limit

2013-09-08 Thread Charles-François Natali

Charles-François Natali added the comment:

I knew this wouldn't be so easy with OS X...

http://buildbot.python.org/all/builders/x86%20Tiger%203.x/builds/6916/steps/test/logs/stdio

==
ERROR: test_above_fd_setsize (test.test_selectors.PollSelectorTestCase)
--
Traceback (most recent call last):
  File /Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/unittest/case.py,
line 56, in testPartExecutor
yield
  File /Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/unittest/case.py,
line 528, in doCleanups
function(*args, **kwargs)
ValueError: not allowed to raise maximum limit

--

Basically, we can't restore RLIMIT_NOFILE to its original value (from
the cleanup callback): since this works on Ned's machine, I assume
this has been fixed in recent OS X versions.
So I'll restore the requires_mac_vers() decorator.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18963
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18963] test_selectors test_above_fd_setsize cases fail on OS X due to infinite hard limit

2013-09-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fa735675e485 by Charles-François Natali in branch 'default':
Issue #18963: skip test_selectors.test_above_fd_setsize on older OS X versions.
http://hg.python.org/cpython/rev/fa735675e485

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18963
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18963] test_selectors test_above_fd_setsize cases fail on OS X due to infinite hard limit

2013-09-08 Thread Charles-François Natali

Charles-François Natali added the comment:

Alright, it should be fixed now, thanks for the report.

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18963
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18963] test_selectors test_above_fd_setsize cases fail on OS X due to infinite hard limit

2013-09-07 Thread Ned Deily

New submission from Ned Deily:

==
ERROR: test_above_fd_setsize (test.test_selectors.PollSelectorTestCase)
--
Traceback (most recent call last):
  File 
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/support/__init__.py,
 line 485, in wrapper
return func(*args, **kw)
  File 
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/test_selectors.py,
 line 312, in test_above_fd_setsize
resource.setrlimit(resource.RLIMIT_NOFILE, (hard, hard))
ValueError: current limit exceeds maximum limit

==
ERROR: test_above_fd_setsize (test.test_selectors.KqueueSelectorTestCase)
--
Traceback (most recent call last):
  File 
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/support/__init__.py,
 line 485, in wrapper
return func(*args, **kw)
  File 
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/test_selectors.py,
 line 312, in test_above_fd_setsize
resource.setrlimit(resource.RLIMIT_NOFILE, (hard, hard))
ValueError: current limit exceeds maximum limit

--
Ran 58 tests in 8.080s

FAILED (errors=2, skipped=12)

Looking at the OS X man page for setrlimit(2), it appears the test's strategy 
of trying to set the soft RLIMIT_NOFILE to the hard RLIMIT_NOFILE ceiling will 
fail on OS X (at least) if the hard limit is infinite:

 import resource
 resource.getrlimit(resource.RLIMIT_NOFILE)
(2560, 9223372036854775807)

From the man page:
COMPATIBILITY
 setrlimit() now returns with errno set to EINVAL in places that 
historically
 succeeded.  It no longer accepts rlim_cur = RLIM_INFINITY for 
RLIM_NOFILE.
 Use rlim_cur = min(OPEN_MAX, rlim_max).

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/setrlimit.2.html

--
components: Tests
messages: 197189
nosy: ned.deily, neologix
priority: normal
severity: normal
stage: needs patch
status: open
title: test_selectors test_above_fd_setsize cases fail on OS X due to infinite 
hard limit
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18963
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18963] test_selectors test_above_fd_setsize cases fail on OS X due to infinite hard limit

2013-09-07 Thread R. David Murray

R. David Murray added the comment:

See also issue issue 17409.

The code isn't setting it to RLIM_INFINITY explicitly, though, so this must 
mean that OSX is reporting an infinite hard limit when the hard limit is not in 
fact infinite.  Seems like this is an OSX bug that we will have to work around 
somehow.  Maybe in getrlimit, by doing the max(OPEN_MAX, rlim_max) dance 
suggested by the osx man page.

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18963
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com