FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-103092: Isolate socket by erlend-aasland · Pull Request #103094 · python/cpython · GitHub

/ cpython Public

gh-103092: Isolate socket - #103094

Merged
kumaraditya303 merged 24 commits into
python:mainfrom
erlend-aasland:isolate-socket
Apr 9, 2023
Merged

gh-103092: Isolate socket#103094
kumaraditya303 merged 24 commits into
python:mainfrom
erlend-aasland:isolate-socket

Conversation

erlend-aasland commented Mar 28, 2023
edited
Loading

Copy link
Copy Markdown
Contributor

Comment thread Modules/socketmodule.c Outdated
Comment thread Modules/socketmodule.c Outdated
erlend-aasland added the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Apr 4, 2023

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @erlend-aasland for commit b4edf64 🤖

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Apr 4, 2023

Copy link
Copy Markdown
Contributor Author

There's some leaks that needs to be adressed:

$ ./python.exe measure.py
before=46451, after=47809
before=47811, after=48549
before=48549, after=49287
before=49287, after=50025
before=50025, after=50763
measure.py
import gc
import sys

for _ in range(5):
    gc.collect()
    before = sys.gettotalrefcount()

    import _socket
    del sys.modules["_socket"]
    del _socket

    gc.collect()
    after = sys.gettotalrefcount()

    print(f"{before=}, {after=}")
    # assert after == before

... and these two:

$ ./python.exe -m test -R : test_socket -m RecvmsgIntoSCMRightsStreamTest                                                                              Raised RLIMIT_NOFILE: 256 -> 1024
0:00:00 load avg: 1.96 Run tests sequentially
0:00:00 load avg: 1.96 [1/1] test_socket
beginning 9 repetitions
123456789
.........
test_socket leaked [10, 10, 10, 10] file descriptors, sum=40
test_socket failed (reference leak)

== Tests result: FAILURE ==

1 test failed:
    test_socket

Total duration: 1.8 sec
Tests result: FAILURE
$ ./python.exe -m test -R : test_socket -m RecvmsgSCMRightsStreamTest                                                                                  Raised RLIMIT_NOFILE: 256 -> 1024
0:00:00 load avg: 2.52 Run tests sequentially
0:00:00 load avg: 2.52 [1/1] test_socket
beginning 9 repetitions
123456789
.........
test_socket leaked [10, 10, 10, 10] file descriptors, sum=40
test_socket failed (reference leak)

== Tests result: FAILURE ==

1 test failed:
    test_socket

Total duration: 1.8 sec
Tests result: FAILURE

Copy link
Copy Markdown
Contributor Author

Regarding #103094 (comment): the file descriptors leak on main as well, so it is not a regression introduced by this PR. Let's not bother with those. There's still references leaked by repeated init of the module, though.

Copy link
Copy Markdown
Contributor Author

Seems like the leaks are due to the capsulated C API not being freed.

Copy link
Copy Markdown
Contributor Author

I'd like to hold this PR until #103261 has landed.

erlend-aasland marked this pull request as ready for review April 8, 2023 19:39
erlend-aasland added the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Apr 8, 2023

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @erlend-aasland for commit 2019a93 🤖

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Apr 8, 2023

kumaraditya303 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

kumaraditya303 merged commit f329a8b into python:main Apr 9, 2023
kumaraditya303 deleted the isolate-socket branch April 9, 2023 01:03
warsaw pushed a commit to warsaw/cpython that referenced this pull request Apr 11, 2023
CharlieZhao95 mentioned this pull request Apr 12, 2023
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL