Opened 10 years ago

Closed 10 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


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 test
Creating test database for alias 'default'...
Exception happened during processing of request from ('', 1925)
Traceback (most recent call last):
  File "c:\Python33\lib\site-packages\django\test\", line 1035, in _handle_request_noblock
    self.process_request(request, client_address)
  File "c:\Python33\lib\", line 332, in process_request
    self.finish_request(request, client_address)
  File "c:\Python33\lib\", line 345, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "c:\Python33\lib\site-packages\django\core\servers\", line 126
, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "c:\Python33\lib\", line 666, in __init__
  File "c:\Python33\lib\wsgiref\", line 118, in handle
    self.raw_requestline = self.rfile.readline()
  File "c:\Python33\lib\", 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

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:

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 test

dependencies: selenium.

bug observed on Windows XP. Also reported on Windows 7. doesn't happen on linux.

Change History (1)

comment:1 by Tim Graham, 10 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #21227

Note: See TracTickets for help on using tickets.
Back to Top