This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: test_socket fails with sem_init: Too many open files
Type: resource usage Stage: needs patch
Components: Tests Versions: Python 3.4, Python 3.5, Python 2.7
Status: open Resolution: duplicate
Dependencies: Superseder: Dangling threads in skipped tests in test_socket
View: 45212
Assigned To: Nosy List: Urs.Traber, iritkatriel, martin.panter, r.david.murray, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2014-10-11 11:23 by Urs.Traber, last changed 2022-04-11 14:58 by admin.

File name Uploaded Description Edit
test_socket.patch Urs.Traber, 2014-10-11 11:23 patch for
Messages (7)
msg229075 - (view) Author: Urs Traber (Urs.Traber) Date: 2014-10-11 11:23 does not clean up its event objects used for synchronization. This may cause multiple such ERRORs (*):

testLinebufferedWrite (__main__.LineBufferedFileObjectClassTestCase) ... sem_init: Too many open files

Fixed by setting the allocated Event objects to None at the end of a test (see patch attached).

*) e.g. on Digital UNIX with a default of maximal 4096 open files per process
msg229092 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-10-11 14:44
I think this is a consequence of issue 11798.  Since Events use filesystem based semaphores on FreeBSD (I think?), it seems reasonable to "fix" this in test_socket specifically in 2.7.
msg231324 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-11-18 14:19
I suggest to merge issue22608 and issue22610 and also clean up other long living event objects in tests.
msg238845 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2015-03-21 22:58
It's a simple patch so can we have a formal review please.
msg238852 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-03-21 23:26
Maybe these patches work around the problem in these cases, but it sounds like the threading.Event class needs to grow a close() method or support the context manager protocol, rather than relying on the garbage collector to clean it up.
msg415838 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-03-22 23:07
I think this was fixed in issue45212.
msg415928 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2022-03-24 08:56
Note that it is a FreeBSD-only issue. We need to test on FreeBSD (ulimit -n can be used for this) to check whether it was fixed in issue45212.
Date User Action Args
2022-04-11 14:58:09adminsetgithub: 66798
2022-03-24 08:56:47serhiy.storchakasetstatus: pending -> open

messages: + msg415928
2022-03-22 23:07:28iritkatrielsetstatus: open -> pending

nosy: + iritkatriel
messages: + msg415838

superseder: Dangling threads in skipped tests in test_socket
resolution: duplicate
2019-03-15 22:23:54BreamoreBoysetnosy: - BreamoreBoy
2015-03-21 23:26:41martin.pantersetnosy: + martin.panter
messages: + msg238852
2015-03-21 22:58:28BreamoreBoysetnosy: + BreamoreBoy
messages: + msg238845
2014-11-18 14:19:25serhiy.storchakasetversions: + Python 3.4, Python 3.5
nosy: + serhiy.storchaka

messages: + msg231324

stage: needs patch
2014-10-11 14:44:31r.david.murraysetnosy: + r.david.murray
messages: + msg229092
2014-10-11 11:23:01Urs.Trabercreate