[issue36750] test_socket leaks file descriptors on macOS

2020-06-07 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

I think I stumbled on this too, I think the test that causes some issue is 
testCmsgTrunc2Int:


./python -m test -R: test_socket -m testCmsgTrunc2Int
0:00:00 load avg: 1.66 Run tests sequentially
0:00:00 load avg: 1.66 [1/1] test_socket
beginning 9 repetitions
123456789
.
test_socket leaked [2, 2, 2, 2] file descriptors, sum=8
test_socket failed

== Tests result: FAILURE ==

1 test failed:
test_socket

Total duration: 2.0 sec
Tests result: FAILURE



There is some file descriptors that are created by newFDs() but they are 
supposed to be cleaned up, maybe it is some race condition as I see that 
test_socket create a thread for each test?

--
nosy: +remi.lapeyre
versions: +Python 3.10, Python 3.9

___
Python tracker 

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



[issue36750] test_socket leaks file descriptors on macOS

2019-04-29 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

The test failure is reproducible on the PR 12271 merging master branch on 
Ubuntu with -R 3:3 test_socket. Sorry, I tried it initially on master thinking 
it was a master branch problem. I don't see C related code in the PR. There was 
a merge commit [0] after which the failure is consistently reproducible. I 
tried reverting parts of the PR to narrow down the failure and happened to come 
across the below statement in the diff where the test object and elapsed test 
for time are stored to be printed later. Commenting out the call makes tests 
pass for test_socket and much more baffling is that changing the code to use 
list instead of tuple causes the error to go away. Also I tried changing append 
to use extend or just to append test object instead of a tuple of test object 
and elapsed time which all pass. Instead of using test object in tuple just 
using (object(), elapsed) as a tuple also causes failure. I guess there is 
something with tuples here but it doesn't make much sense.

On trying to bisect the merge commit I have narrowed down the below commits 
where the PR passes with tuple itself and then fails. In between the success 
and failure commit there were some changes made to hunterleaks and 
socket.create_server utility was added.

 f66e336f45 (success)
 58721a9030 (success)
 2b00db68554422ec37faba2a80179a0172df6349 (fails)

# Sample failure on PR's HEAD on Ubuntu 

⋊> ~/cpython on pr_12271  ./python -m test --fail-env-changed -R 3:3 
test_socket 
   05:45:52
Run tests sequentially
0:00:00 load avg: 0.22 [1/1] test_socket
beginning 6 repetitions
123456
Warning -- threading_cleanup() failed to cleanup 0 threads (count: 0, dangling: 
5)
Dangling thread: 
Dangling thread: 
Dangling thread: 
Dangling thread: 
Dangling thread: <_MainThread(MainThread, started 140152731227904)>
..
test_socket failed (env changed) in 3 min 6 sec

== Tests result: ENV CHANGED ==

1 test altered the execution environment:
test_socket

Total duration: 3 min 6 sec
Tests result: ENV CHANGED

The below patch on the PR to use list causes the tests to pass but I am highly 
confused over how changing to tuple to list fixes this and this might 
potentially be hiding a bug.

$ git diff
diff --git a/Lib/unittest/result.py b/Lib/unittest/result.py
index 273ca3beef..b8fd714679 100644
--- a/Lib/unittest/result.py
+++ b/Lib/unittest/result.py
@@ -160,7 +160,7 @@ class TestResult(object):

 def addDuration(self, test, elapsed):
 """Called when a test finished to run, regardless of its outcome."""
-self.collectedDurations.append((test, elapsed))
+self.collectedDurations.append([test, elapsed])

 def wasSuccessful(self):
 """Tells whether or not this result was a success."""

[0] 
https://github.com/python/cpython/commit/3c4af91c1e7c02561efa752885011ff642725bd8

--

___
Python tracker 

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



[issue36750] test_socket leaks file descriptors on macOS

2019-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +pablogsal
title: test_socket failed (env changed) on Azure pipeline -> test_socket leaks 
file descriptors on macOS

___
Python tracker 

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