Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poplib and imaplib should catch "OSError: [WinError 10022] An invalid argument was supplied" on shutdown #74514

Closed
vstinner opened this issue May 10, 2017 · 8 comments
Assignees
Labels
3.7 (EOL) end of life OS-windows stdlib Python modules in the Lib dir tests Tests in the Lib/test dir topic-SSL

Comments

@vstinner
Copy link
Member

BPO 30329
Nosy @pfmoore, @vstinner, @tiran, @tjguk, @zware, @zooba
PRs
  • bpo-30329: Catch Windows error 10022 on shutdown() #1538
  • [3.6] bpo-30329: Catch Windows error 10022 on shutdown() (#1538) #1620
  • [3.5] bpo-30329: Catch Windows error 10022 on shutdown() (#1538) #1621
  • [2.7] bpo-30329: Catch Windows error 10022 on shutdown() (#1538) #1624
  • 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/tiran'
    closed_at = <Date 2017-06-26.23:01:05.809>
    created_at = <Date 2017-05-10.12:26:48.090>
    labels = ['expert-SSL', '3.7', 'tests', 'OS-windows', 'library']
    title = 'poplib and imaplib should catch "OSError: [WinError 10022] An invalid argument was supplied" on shutdown'
    updated_at = <Date 2017-06-26.23:06:53.664>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2017-06-26.23:06:53.664>
    actor = 'vstinner'
    assignee = 'christian.heimes'
    closed = True
    closed_date = <Date 2017-06-26.23:01:05.809>
    closer = 'vstinner'
    components = ['Library (Lib)', 'Tests', 'Windows', 'SSL']
    creation = <Date 2017-05-10.12:26:48.090>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30329
    keywords = ['buildbot']
    message_count = 8.0
    messages = ['293411', '293699', '293716', '293814', '293818', '293830', '296967', '296970']
    nosy_count = 6.0
    nosy_names = ['paul.moore', 'vstinner', 'christian.heimes', 'tim.golden', 'zach.ware', 'steve.dower']
    pr_nums = ['1538', '1620', '1621', '1624']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue30329'
    versions = ['Python 3.5', 'Python 3.6', 'Python 3.7']

    @vstinner
    Copy link
    Member Author

    See also bpo-30319: test_invalid_authentication() of test_imaplib: ConnectionResetError: [Errno 54] Connection reset by peer on AMD64 FreeBSD 9.x 3.6.

    http://buildbot.python.org/all/builders/AMD64%20Windows8.1%20Non-Debug%203.6/builds/375/steps/test/logs/stdio

    test_login_cram_md5 (test.test_imaplib.ThreadedNetworkedTestsSSL) ... creating server
    server created
    ADDR = ('127.0.0.1', 0)
    CLASS = <class 'test.test_imaplib.SecureTCPServer'>
    HDLR = <class 'test.test_imaplib.ThreadedNetworkedTests.test_login_cram_md5.<locals>.AuthHandler'>
    server running
    SENT: b'* OK IMAP4rev1'
    GOT: b'PJGL0 CAPABILITY'
    SENT: b'* CAPABILITY IMAP4rev1 LOGINDISABLED AUTH=CRAM-MD5'
    SENT: b'PJGL0 OK CAPABILITY completed'
    GOT: b'PJGL1 AUTHENTICATE CRAM-MD5'
    SENT: b'+ PDE4OTYuNjk3MTcwOTUyQHBvc3RvZmZpY2UucmVzdG9uLm1jaS5uZXQ='
    GOT: b'dGltIGYxY2E2YmU0NjRiOWVmYTFjY2E2ZmZkNmNmMmQ5ZjMy'
    SENT: b'PJGL1 OK CRAM-MD5 successful'
    GOT: b'PJGL2 LOGOUT'
    SENT: b'* BYE IMAP4ref1 Server logging out'
    SENT: b'PJGL2 OK LOGOUT completed'
    waiting for server
    done
    ERROR

    ======================================================================
    ERROR: test_login_cram_md5 (test.test_imaplib.ThreadedNetworkedTestsSSL)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "D:\buildarea\3.6.ware-win81-release\build\lib\test\support\__init__.py", line 2035, in decorator
        return func(*args)
      File "D:\buildarea\3.6.ware-win81-release\build\lib\test\test_imaplib.py", line 796, in test_login_cram_md5
        self.assertEqual(ret, "OK")
      File "D:\buildarea\3.6.ware-win81-release\build\lib\contextlib.py", line 89, in __exit__
        next(self.gen)
      File "D:\buildarea\3.6.ware-win81-release\build\lib\test\test_imaplib.py", line 567, in reaped_pair
        client.logout()
      File "D:\buildarea\3.6.ware-win81-release\build\lib\imaplib.py", line 622, in logout
        self.shutdown()
      File "D:\buildarea\3.6.ware-win81-release\build\lib\imaplib.py", line 320, in shutdown
        self.sock.shutdown(socket.SHUT_RDWR)
      File "D:\buildarea\3.6.ware-win81-release\build\lib\ssl.py", line 1040, in shutdown
        socket.shutdown(self, how)
    OSError: [WinError 10022] An invalid argument was supplied

    Ran 95 tests in 6.890s

    FAILED (errors=1, skipped=4)
    test test_imaplib failed

    @vstinner vstinner added topic-SSL tests Tests in the Lib/test dir OS-windows labels May 10, 2017
    @vstinner
    Copy link
    Member Author

    The error code is documented:

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms740481(v=vs.85).aspx

    WSAEINVAL: The how parameter is not valid, or is not consistent with the socket type. For example, SD_SEND is used with a UNI_RECV socket type.

    @vstinner
    Copy link
    Member Author

    New changeset 83a2c28 by Victor Stinner in branch 'master':
    bpo-30329: Catch Windows error 10022 on shutdown() (bpo-1538)
    83a2c28

    @vstinner vstinner added 3.7 (EOL) end of life stdlib Python modules in the Lib dir labels May 16, 2017
    @vstinner vstinner changed the title test_imaplib.test_login_cram_md5(): OSError: [WinError 10022] An invalid argument was supplied on AMD64 Windows8.1 Non-Debug 3.6 poplib and imaplib should catch "OSError: [WinError 10022] An invalid argument was supplied" on shutdown May 16, 2017
    @vstinner
    Copy link
    Member Author

    New changeset aaa0536 by Victor Stinner in branch '3.6':
    bpo-30329: Catch Windows error 10022 on shutdown() (bpo-1538) (bpo-1620)
    aaa0536

    @vstinner
    Copy link
    Member Author

    New changeset c9ba45d by Victor Stinner in branch '3.5':
    bpo-30329: Catch Windows error 10022 on shutdown() (bpo-1538) (bpo-1621)
    c9ba45d

    @vstinner
    Copy link
    Member Author

    New changeset 800e4b7 by Victor Stinner in branch '2.7':
    bpo-30329: Catch Windows error 10022 on shutdown() (bpo-1538) (bpo-1624)
    800e4b7

    @vstinner
    Copy link
    Member Author

    The bug should now be catched.

    @vstinner
    Copy link
    Member Author

    The bug should now be catched.

    Oops, I wanted to write: "should now be fixed", sorry!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life OS-windows stdlib Python modules in the Lib dir tests Tests in the Lib/test dir topic-SSL
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants