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

test_ssl failure #51382

Closed
pitrou opened this issue Oct 14, 2009 · 9 comments
Closed

test_ssl failure #51382

pitrou opened this issue Oct 14, 2009 · 9 comments
Assignees
Labels
extension-modules C modules in the Modules dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@pitrou
Copy link
Member

pitrou commented Oct 14, 2009

BPO 7133
Nosy @kbkaiser, @orsenthil, @pitrou
Files
  • ssl_newbuf.patch
  • 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/pitrou'
    closed_at = <Date 2009-10-19.18:00:17.133>
    created_at = <Date 2009-10-14.22:41:11.049>
    labels = ['extension-modules', 'type-bug', 'tests']
    title = 'test_ssl failure'
    updated_at = <Date 2011-09-26.13:30:44.784>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2011-09-26.13:30:44.784>
    actor = 'kbriggs'
    assignee = 'pitrou'
    closed = True
    closed_date = <Date 2009-10-19.18:00:17.133>
    closer = 'pitrou'
    components = ['Extension Modules', 'Tests']
    creation = <Date 2009-10-14.22:41:11.049>
    creator = 'pitrou'
    dependencies = []
    files = ['15130']
    hgrepos = []
    issue_num = 7133
    keywords = ['patch']
    message_count = 9.0
    messages = ['94044', '94048', '94123', '94245', '94246', '94247', '144407', '144536', '144537']
    nosy_count = 5.0
    nosy_names = ['kbk', 'janssen', 'kbriggs', 'orsenthil', 'pitrou']
    pr_nums = []
    priority = 'high'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue7133'
    versions = ['Python 2.7']

    @pitrou
    Copy link
    Member Author

    pitrou commented Oct 14, 2009

    This is due to r75412 (yes, mine). The proper fix would be to add
    support for the new buffer API to the _ssl module.

    testSocketServer (test.test_ssl.ThreadedTests) ...
    server (('127.0.0.1', 52011):52011 ('AES256-SHA', 'TLSv1/SSLv3', 256)):
    [15/Oct/2009 00:42:18] "GET /keycert.pem HTTP/1.0" 200 -
    ----------------------------------------

    Exception happened during processing of request from ('127.0.0.1', 48099)
    Traceback (most recent call last):
      File "/home/antoine/cpython/__svn__/Lib/SocketServer.py", line 282, in
    _handle_request_noblock
        self.process_request(request, client_address)
      File "/home/antoine/cpython/__svn__/Lib/SocketServer.py", line 308, in
    process_request
        self.finish_request(request, client_address)
      File "/home/antoine/cpython/__svn__/Lib/SocketServer.py", line 321, in
    finish_request
        self.RequestHandlerClass(request, client_address, self)
      File "/home/antoine/cpython/__svn__/Lib/SocketServer.py", line 639, in
    __init__
        self.finish()
      File "/home/antoine/cpython/__svn__/Lib/SocketServer.py", line 692, in
    finish
        self.wfile.flush()
      File "/home/antoine/cpython/__svn__/Lib/socket.py", line 300, in flush
        self._sock.sendall(view[write_offset:write_offset+buffer_size])
      File "/home/antoine/cpython/__svn__/Lib/ssl.py", line 203, in sendall
        v = self.send(data[count:])
      File "/home/antoine/cpython/__svn__/Lib/ssl.py", line 94, in <lambda>
        self.send = lambda data, flags=0: SSLSocket.send(self, data, flags)
      File "/home/antoine/cpython/__svn__/Lib/ssl.py", line 174, in send
        v = self._sslobj.write(data)
    TypeError: must be string or read-only buffer, not memoryview
    ----------------------------------------
    
    Traceback (most recent call last):
      File "/home/antoine/cpython/__svn__/Lib/test/test_ssl.py", line 972,
    in testSocketServer
        f = urllib.urlopen(url)
      File "/home/antoine/cpython/__svn__/Lib/urllib.py", line 87, in urlopen
        return opener.open(url)
      File "/home/antoine/cpython/__svn__/Lib/urllib.py", line 206, in open
        return getattr(self, name)(url)
      File "/home/antoine/cpython/__svn__/Lib/urllib.py", line 445, in
    open_https
        'got a bad status line', None)
    IOError: ('http protocol error', 0, 'got a bad status line', None)
    ERROR

    @pitrou pitrou self-assigned this Oct 14, 2009
    @pitrou pitrou added extension-modules C modules in the Modules dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Oct 14, 2009
    @pitrou
    Copy link
    Member Author

    pitrou commented Oct 14, 2009

    Here is a possible patch.

    @kbkaiser
    Copy link
    Contributor

    Reviewed, built, tests ok.

    Linux trader 2.6.18-ARCH #1 SMP PREEMPT Sun Nov 19 09:14:35 CET 2006
    i686 Intel(R) Pentium(R) 4 CPU 2.40GHz GenuineIntel GNU/Linux

    vote +1 weight +0.1 :-)

    @kbkaiser
    Copy link
    Contributor

    Is there some reason that this is not being checked
    in? The build has been broken for five days. IMO,
    either revert the offending code or check this in.

    @pitrou
    Copy link
    Member Author

    pitrou commented Oct 19, 2009

    I was hoping for Bill (the _ssl maintainer)'s opinion on this, but
    you're right, it should be checked in.

    @pitrou
    Copy link
    Member Author

    pitrou commented Oct 19, 2009

    Committed in r75529.

    @pitrou pitrou closed this as completed Oct 19, 2009
    @kbriggs
    Copy link
    Mannequin

    kbriggs mannequin commented Sep 22, 2011

    I am still getting this error with SocketServer in Python 2.7.2, even though it looks the same as was fixed in bpo-7133:

    File "/usr/local/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
    File "/usr/local/lib/python2.7/SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
    File "/usr/local/lib/python2.7/SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
    File "/usr/local/lib/python2.7/SocketServer.py", line 641, in __init__
    self.finish()
    File "/usr/local/lib/python2.7/SocketServer.py", line 694, in finish
    self.wfile.flush()
    File "/usr/local/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
    TypeError: must be string or read-only buffer, not memoryview

    Keith

    @orsenthil
    Copy link
    Member

    Keith, was your python compiled with ssl? Any extra information to reproduce this can help. (Download 2.7.2 from python.org, do a ./configure;make and verify if this can bug can be reproduced).

    @kbriggs
    Copy link
    Mannequin

    kbriggs mannequin commented Sep 26, 2011

    Senthil: thanks for the reply. That's how I did build python 2.7.2 anyway. But I can't see anything about SSL in the generated config files. However, on another system (Fedora 15 with python 2.7.1), I don't get the problem.
    In case it's useful, I was trying to run the recipe http://code.activestate.com/recipes/573444-threaded-documenting-xml-rpc-server-over-https/?c=13559 when this crash happened. Is there something in that recipe which is not compatible with the current python modules?

    Keith

    @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
    extension-modules C modules in the Modules dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants