EyeSeeTea / d2-docker

GNU General Public License v3.0
9 stars 3 forks source link

Connection reset by peer with stdlib request #46

Open ifoche opened 4 years ago

ifoche commented 4 years ago

Randomly, it happens sometimes the following error:

[d2-docker:DEBUG] wait_for_server:url=http://localhost:8080
Traceback (most recent call last):
  File "src/d2_docker/cli.py", line 81, in <module>
    sys.exit(main())
  File "src/d2_docker/cli.py", line 74, in main
    return args.func(args)
  File "/home/nacho/EyeSeeTea/code/d2-docker/src/d2_docker/commands/upgrade.py", line 49, in run
    keep_running=keep_running,
  File "/home/nacho/EyeSeeTea/code/d2-docker/src/d2_docker/commands/upgrade.py", line 97, in upgrade_to_version
    if not utils.wait_for_server(final_port):
  File "/home/nacho/EyeSeeTea/code/d2-docker/src/d2_docker/utils.py", line 426, in wait_for_server
    urllib.request.urlopen(url)
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 1353, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/usr/lib/python3.6/urllib/request.py", line 1328, in do_open
    r = h.getresponse()
  File "/usr/lib/python3.6/http/client.py", line 1356, in getresponse
    response.begin()
  File "/usr/lib/python3.6/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.6/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer

Second execution seems to work

tokland commented 3 years ago

I had never seen this error, but clearly ConnectionResetError should be one of the exceptions catched in the wait loop.