Opened 11 years ago
Closed 11 years ago
#22252 closed Bug (duplicate)
ConnectionResetError: [WinError 10054] in LiveServerTestCase with Selenium on Windows
Reported by: | Harry Percival | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | 1.6 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When using LiveServerTestCase to run selenium tests, on Windows, a nasty warning comes out of the server thread, which makes it hard to distinguish real failure messages:
$ python manage.py test Creating test database for alias 'default'... ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 1925) Traceback (most recent call last): File "c:\Python33\lib\site-packages\django\test\testcases.py", line 1035, in _handle_request_noblock self.process_request(request, client_address) File "c:\Python33\lib\socketserver.py", line 332, in process_request self.finish_request(request, client_address) File "c:\Python33\lib\socketserver.py", line 345, in finish_request self.RequestHandlerClass(request, client_address, self) File "c:\Python33\lib\site-packages\django\core\servers\basehttp.py", line 126 , in __init__ super(WSGIRequestHandler, self).__init__(*args, **kwargs) File "c:\Python33\lib\socketserver.py", line 666, in __init__ self.handle() File "c:\Python33\lib\wsgiref\simple_server.py", line 118, in handle self.raw_requestline = self.rfile.readline() File "c:\Python33\lib\socket.py", line 297, in readinto return self._sock.recv_into(b) ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host ---------------------------------------- . ---------------------------------------------------------------------- Ran 1 test in 9.323s OK Destroying test database for alias 'default'...
I have done some work with git-bisect to nail down a minimal repro. The conditions seem to be:
- the site has to be using some sort of static files, eg css
- the bug only occurs when selenium reloads a page, eg by clicking on a link
I have a minimal, one-page repro, available here:
https://github.com/hjwp/liveservertestcase-windows-bug
I speculate it's something to do with the server thread's static files app? and maybe something not terminating connections properly? either way, the error probably doesn't need fixing per se, but it would be nice if we could silence it. I've hacked about with the threaded wsgiserver code, but no luck.
to repro, just run python manage.py test
dependencies: selenium.
bug observed on Windows XP. Also reported on Windows 7. doesn't happen on linux.
Duplicate of #21227