This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_urllib2_localnet prints out error messages
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: orsenthil, pitrou, python-dev
Priority: normal Keywords:

Created on 2014-08-21 23:33 by pitrou, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg225622 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-08-21 23:33
I get the following error messages in the test suite:

[1/1] test_urllib2_localnet
test_basic_auth_httperror (test.test_urllib2_localnet.BasicAuthTests) ... ----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 44046)
Traceback (most recent call last):
  File "/home/antoine/cpython/34/Lib/socketserver.py", line 305, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/home/antoine/cpython/34/Lib/socketserver.py", line 331, in process_request
    self.finish_request(request, client_address)
  File "/home/antoine/cpython/34/Lib/socketserver.py", line 344, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/antoine/cpython/34/Lib/test/test_urllib2_localnet.py", line 291, in http_server_with_basic_auth_handler
    return BasicAuthHandler(*args, **kwargs)
  File "/home/antoine/cpython/34/Lib/test/test_urllib2_localnet.py", line 212, in __init__
    http.server.BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
  File "/home/antoine/cpython/34/Lib/socketserver.py", line 669, in __init__
    self.handle()
  File "/home/antoine/cpython/34/Lib/http/server.py", line 398, in handle
    self.handle_one_request()
  File "/home/antoine/cpython/34/Lib/http/server.py", line 387, in handle_one_request
    self.wfile.flush() #actually send the response if not already done.
ValueError: I/O operation on closed file.
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 44047)
Traceback (most recent call last):
  File "/home/antoine/cpython/34/Lib/socketserver.py", line 305, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/home/antoine/cpython/34/Lib/socketserver.py", line 331, in process_request
    self.finish_request(request, client_address)
  File "/home/antoine/cpython/34/Lib/socketserver.py", line 344, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/antoine/cpython/34/Lib/test/test_urllib2_localnet.py", line 291, in http_server_with_basic_auth_handler
    return BasicAuthHandler(*args, **kwargs)
  File "/home/antoine/cpython/34/Lib/test/test_urllib2_localnet.py", line 212, in __init__
    http.server.BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
  File "/home/antoine/cpython/34/Lib/socketserver.py", line 669, in __init__
    self.handle()
  File "/home/antoine/cpython/34/Lib/http/server.py", line 398, in handle
    self.handle_one_request()
  File "/home/antoine/cpython/34/Lib/http/server.py", line 387, in handle_one_request
    self.wfile.flush() #actually send the response if not already done.
ValueError: I/O operation on closed file.
----------------------------------------
ok
test_basic_auth_success (test.test_urllib2_localnet.BasicAuthTests) ... ----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 60893)
Traceback (most recent call last):
  File "/home/antoine/cpython/34/Lib/socketserver.py", line 305, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/home/antoine/cpython/34/Lib/socketserver.py", line 331, in process_request
    self.finish_request(request, client_address)
Exception happened during processing of request from ('127.0.0.1', 60894)
Traceback (most recent call last):
  File "/home/antoine/cpython/34/Lib/socketserver.py", line 305, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/home/antoine/cpython/34/Lib/socketserver.py", line 331, in process_request
    self.finish_request(request, client_address)
  File "/home/antoine/cpython/34/Lib/socketserver.py", line 344, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/antoine/cpython/34/Lib/test/test_urllib2_localnet.py", line 291, in http_server_with_basic_auth_handler
    return BasicAuthHandler(*args, **kwargs)
  File "/home/antoine/cpython/34/Lib/test/test_urllib2_localnet.py", line 212, in __init__
    http.server.BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
  File "/home/antoine/cpython/34/Lib/socketserver.py", line 669, in __init__
    self.handle()
  File "/home/antoine/cpython/34/Lib/http/server.py", line 398, in handle
    self.handle_one_request()
  File "/home/antoine/cpython/34/Lib/http/server.py", line 387, in handle_one_request
    self.wfile.flush() #actually send the response if not already done.
ValueError: I/O operation on closed file.
----------------------------------------
ok


It seems they were introduced by 30e8a8f22a2a.
msg225654 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2014-08-22 10:16
Interesting. I had not noticed these with my run on Mac and neither did Buildbots report. Looks like explicit closing of wfile do_GET method can be cause of tis problem.
msg225655 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-08-22 10:57
New changeset 48a77fbfd6cb by Senthil Kumaran in branch '3.4':
Fix issue22245 - Fix urllib2_localnet test.
http://hg.python.org/cpython/rev/48a77fbfd6cb

New changeset cb291294bdc8 by Senthil Kumaran in branch 'default':
merge from 3.4
http://hg.python.org/cpython/rev/cb291294bdc8
msg225656 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2014-08-22 10:59
It was reproducible on my local machine too. Those errors were present and somehow escaped me. Thanks for raising this.

Fixed these and tested in my local machine and test_urllib2_localnet was successful.
History
Date User Action Args
2022-04-11 14:58:07adminsetgithub: 66441
2014-08-22 10:59:05orsenthilsetstatus: open -> closed
messages: + msg225656

assignee: orsenthil
resolution: fixed
stage: resolved
2014-08-22 10:57:24python-devsetnosy: + python-dev
messages: + msg225655
2014-08-22 10:16:20orsenthilsetmessages: + msg225654
2014-08-21 23:33:28pitroucreate