Skip to content

ResourceWarning: unclosed <ssl.SSLSocket ...> test_pha_required_nocert #88051

Closed

Description

@tiran
BPO 43885
Nosy @vstinner, @tiran, @zooba, @shihai1991
Superseder
  • bpo-37322: test_ssl: test_pha_required_nocert() emits a ResourceWarning
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/zooba'
    closed_at = <Date 2021-04-23.09:10:15.599>
    created_at = <Date 2021-04-19.08:07:46.388>
    labels = ['expert-SSL', '3.8', '3.9', '3.10', 'performance']
    title = 'ResourceWarning: unclosed <ssl.SSLSocket ...> test_pha_required_nocert'
    updated_at = <Date 2021-04-23.09:10:15.598>
    user = 'https://github.com/tiran'

    bugs.python.org fields:

    activity = <Date 2021-04-23.09:10:15.598>
    actor = 'christian.heimes'
    assignee = 'steve.dower'
    closed = True
    closed_date = <Date 2021-04-23.09:10:15.599>
    closer = 'christian.heimes'
    components = ['SSL']
    creation = <Date 2021-04-19.08:07:46.388>
    creator = 'christian.heimes'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43885
    keywords = []
    message_count = 3.0
    messages = ['391367', '391391', '391670']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'christian.heimes', 'steve.dower', 'shihai1991']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '37322'
    type = 'resource usage'
    url = 'https://bugs.python.org/issue43885'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    Activity

    1. tiran commented on Apr 19, 2021

      @tiran
      MemberAuthor

      bpo-35926 and fb7e750 introduced code that is triggered resource errors and unhandled exceptions. It has been bothering me for a while but I could never pin point the issue. Victor's and Hai's commits
      e80697d and 73ea546 seem to be related, too.

      I don't understand the purpose of the test changes in fb7e750. The commit looks wrong to me. Could you please take a look?

      $ ./python -X tracemalloc=10 -m test test_ssl
      0:00:00 load avg: 1.37 Run tests sequentially
      0:00:00 load avg: 1.37 [1/1] test_ssl
      /home/heimes/dev/python/cpython/Lib/test/support/threading_helper.py:209: ResourceWarning: unclosed <ssl.SSLSocket fd=5, family=AF_INET, type=SOCK_STREAM, proto=0, laddr=('127.0.0.1', 32937), raddr=('127.0.0.1', 60292)>
      del self.thread
      Object allocated at (most recent call last):
      File "/home/heimes/dev/python/cpython/Lib/threading.py", lineno 948
      self._bootstrap_inner()
      File "/home/heimes/dev/python/cpython/Lib/threading.py", lineno 990
      self.run()
      File "/home/heimes/dev/python/cpython/Lib/test/test_ssl.py", lineno 2404
      if not self.wrap_conn():
      File "/home/heimes/dev/python/cpython/Lib/test/test_ssl.py", lineno 2331
      self.sslconn = self.server.context.wrap_socket(
      File "/home/heimes/dev/python/cpython/Lib/ssl.py", lineno 513
      return self.sslsocket_class._create(
      File "/home/heimes/dev/python/cpython/Lib/ssl.py", lineno 1028
      self = cls.__new__(cls, **kwargs)

      $ ./python -W "error::ResourceWarning" -m test test_ssl
      0:00:00 load avg: 1.24 Run tests sequentially
      0:00:00 load avg: 1.24 [1/1] test_ssl
      Warning -- Unraisable exception
      Exception ignored in: <ssl.SSLSocket fd=5, family=AF_INET, type=SOCK_STREAM, proto=0, laddr=('127.0.0.1', 49843), raddr=('127.0.0.1', 39420)>
      Traceback (most recent call last):
        File "/home/heimes/dev/python/cpython/Lib/test/support/threading_helper.py", line 209, in __exit__
          del self.thread
      ResourceWarning: unclosed <ssl.SSLSocket fd=5, family=AF_INET, type=SOCK_STREAM, proto=0, laddr=('127.0.0.1', 49843), raddr=('127.0.0.1', 39420)>
      test_ssl failed (env changed)
    2. vstinner commented on Apr 19, 2021

      @vstinner
      Member

      Duplicate of bpo-37322 that I reported at 2019-06-17.

    3. tiran commented on Apr 23, 2021

      @tiran
      MemberAuthor

      Thanks Victor, let's handle the issue in bpo-37322 instead.

    4. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions