markhobson / docker-maven-chrome

Docker image for Java automated UI tests.
https://hub.docker.com/r/markhobson/maven-chrome/
Apache License 2.0
97 stars 81 forks source link

Error: CreatePlatformSocket() failed: Address family not supported by protocol (97) #39

Closed thedefside closed 1 year ago

thedefside commented 1 year ago

I'm getting this error when running my selenium tests in your container. The error appears right after the chromedriver is started:

Starting ChromeDriver 104.0.5112.79 (3cf3e8c8a07d104b9e1260c910efb8f383285dc5-refs/branch-heads/5112@{#1307}) on port 45363 
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[ChromeDriver was started successfully.
1661868538.001][SEVERE]: CreatePlatformSocket() failed: Address family not supported by protocol (97)
[1661868538.649][SEVERE]: CreatePlatformSocket() failed: Address family not supported by protocol (97)

Then, all my tests fail with the same error:

org.openqa.selenium.TimeoutException: 
timeout: Timed out receiving message from renderer: 29.799
  (Session info: headless chrome=104.0.5112.101)
Build info: version: '4.4.0', revision: 'e5c75ed026a'
System info: host: 'runner-3vmhfkx-project-1343-concurrent-0', ip: '172.17.0.5', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-104-generic', java.version: '18.0.1.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [9c4f0f720cf9511d39901d6733b56ac1, get {url=redacted}]
selenide.url: https://mfe-individual-root-config-q.apps.pcfnp.fnni.com/individual/accounts
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 104.0.5112.101, chrome: {chromedriverVersion: 104.0.5112.79 (3cf3e8c8a07d..., userDataDir: /tmp/.com.google.Chrome.leKnwP}, goog:chromeOptions: {debuggerAddress: localhost:39713}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: LINUX, proxy: Proxy(), se:cdp: ws://localhost:39713/devtoo..., se:cdpVersion: 104.0.5112.101, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: accept, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
selenide.baseUrl: redacted
Session ID: 9c4f0f720cf9511d39901d6733b56ac1
      at uitestsindividual.HeaderFooter.HeaderMobileTests.setup(HeaderMobileTests.java:21)

I am running the docker container in a gitlab pipeline. So far, this specific error seems to be related to either the hosts file or IPv6 being disabled.

https://stackoverflow.com/a/48161643/9558744 https://bugs.chromium.org/p/chromium/issues/detail?id=700347

I was wondering if you could verify for me that the hosts file is configured correctly, and that the version of linux used supports IPv6. Thank you!

markhobson commented 1 year ago

Hi, looks like you're using the jdk-18 image?

You can see the hosts file as follows:

$ docker run --rm -it markhobson/maven-chrome:jdk-18 cat /etc/hosts
127.0.0.1   localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2  5cc4463b50b4

And it looks like IPv6 is enabled:

$ docker run --rm -it markhobson/maven-chrome:jdk-18 cat /sys/module/ipv6/parameters/disable
0

Can you reproduce this problem locally or does it only occur in GitLab?

markhobson commented 1 year ago

Closing due to inactivity.