selenium: Regression in Selenium >= 3.8.1: ConnectionResetError with chromedriver and Travis CI (Packet instance, not EC2)

Meta

OS: Ubuntu Trusty (Travis CI, Packet) Selenium Version: >= 3.8.1 Browser: latest Chrome (69) with latest chromedriver (2.42)

Expected Behavior

Selenium should work like <= 3.8.0, without ConnectionResetError

Actual Behavior

  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/selenium/webdriver/remote/remote_connection.py", line 397, in _request
    resp = self._conn.request(method, url, body=body, headers=headers)
[...]
  File "/opt/python/3.6.3/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

Steps to reproduce

Just use Selenium >= 3.8.1 (incl. 3.14.1) with chromedriver and Travis CI Packet instance (EC2 instance works good for me).

Selenium 3.8.0 works good.

I can’t reproduce this problem using Python 2.7 (Python 3.x socket bug?)

I made a special repository for testing, see results here: https://travis-ci.org/andreymal/selenium-travis-test/branches

You can see the full log with traceback here: https://travis-ci.org/andreymal/selenium-travis-test/jobs/430688661

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 15 (9 by maintainers)

Most upvoted comments

@cgoldberg This is exactly the same bug as #5296. Even is_connectable is correctly identified there. Imo #5296 should be reopened.

I think I found the reason that commit is problematic.

I think a bug exists in the is_connectable function it’s using (from py/selenium/webdriver/common/utils.py)

is_connectable relies on socket.create_connection raising a socket.error. This is fine in Python 2 but not Python 3. Starting with python 3.3, socket.create_connection no longer raises socket.error. So instead of returning False, the function just bails when a ConnectionResetError is raised.