Docker-selenium: Firefox has problems / ipc_channel_posix

Created on 12 Feb 2017  路  28Comments  路  Source: SeleniumHQ/docker-selenium

Meta -

Image(s):

  • hub
  • node-chrome
  • node-firefox

Docker Version:
1.12.6
OS:
Ubuntu 15.10

Expected Behavior -

Firefox opens website.

Actual Behavior -

firefox_1    | 13:29:31.484 INFO - Executing: [get: http://mike-pretzlaw.de])
firefox_1    | [Parent 119] WARNING: pipe error (55): Connection reset by peer: file /builds/slave/m-rel-l64-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 323
firefox_1    | [Parent 119] WARNING: pipe error: Broken pipe: file /builds/slave/m-rel-l64-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 687
firefox_1    | [Parent 119] WARNING: pipe error (48): Connection reset by peer: file /builds/slave/m-rel-l64-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 323
firefox_1    | [Parent 119] WARNING: pipe error (45): Connection reset by peer: file /builds/slave/m-rel-l64-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 323
R-awaiting-answer

Most helpful comment

those reactions "are" the +1 馃憤

All 28 comments

we'll need a little more information before we can see what exactly is going wrong here. can you provide a little more information on your image versions you're using, your docker-compose.yml file, and possibly the relevant section of your test you are using to create the sessions

e.g.: FirefoxDriver driver = new FirefoxDriver()..

@sourcerer-mike did you ever resolve this? I'm getting the same thing.

I am also getting these errors. Here is my compose file, and my configuration details:

Image(s): selenium/node-phantomjs:3.3 and selenium/hub:3.3
Docker Version: 17.03.1-ce-mac5 (16048)
OS: macOS Sierra

My compose file:

version: '2'
services:
  selenium-hub:
    image: "selenium/hub:3.3"
    ports:
      - "127.0.0.1:4444:4444"
    restart: always
    environment:
      # Reclaims resources if download code crashes
      GRID_TIMEOUT: 30
      # Needed in case Firefox tries to update itself...
      GRID_BROWSER_TIMEOUT: 60
  ff1:
    image: "selenium/node-firefox:3.3"
    links:
      - "selenium-hub:hub"
    restart: always
    environment:
      HUB_PORT_4444_TCP_ADDR: selenium-hub
      HUB_PORT_4444_TCP_PORT: 4444
  ff2:
    image: "selenium/node-firefox:3.3"
    links:
      - "selenium-hub:hub"
    restart: always
    environment:
      HUB_PORT_4444_TCP_ADDR: selenium-hub
      HUB_PORT_4444_TCP_PORT: 4444

And my error messages:

selenium-hub_1  | 18:52:24.422 INFO - Got a request to create a new session: Capabilities [{marionette=true, acceptInsecureCerts=true, browserName=firefox, javascriptEnabled=true, version=, platform=ANY}]
selenium-hub_1  | 18:52:24.423 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, browserName=firefox, maxInstances=1, version=52.0.2, applicationName=, platform=LINUX}
ff1_1           | 18:52:24.425 INFO - Executing: [new session: Capabilities [{marionette=true, acceptInsecureCerts=true, browserName=firefox, javascriptEnabled=true, version=, platform=ANY}]])
ff1_1           | 18:52:24.427 INFO - Creating a new session for Capabilities [{marionette=true, acceptInsecureCerts=true, browserName=firefox, javascriptEnabled=true, version=, platform=ANY}]
ff1_1           | 1492541544453 geckodriver INFO    Listening on 127.0.0.1:20643
ff1_1           | 1492541544518 mozprofile::profile INFO    Using profile path /tmp/rust_mozprofile.KZ7U81MsaePK
ff1_1           | 1492541544520 geckodriver::marionette INFO    Starting browser /usr/bin/firefox with args []
ff1_1           | 1492541544524 geckodriver::marionette INFO    Connecting to Marionette on localhost:39605
ff1_1           | 1492541545276 Marionette  INFO    Listening on port 39605
ff1_1           | 1492541545525 Marionette  WARN    TLS certificate errors will be ignored for this session
ff1_1           | 18:52:26.762 INFO - Detected dialect: W3C
ff1_1           | 18:52:26.764 INFO - Done: [new session: Capabilities [{marionette=true, acceptInsecureCerts=true, browserName=firefox, javascriptEnabled=true, version=, platform=ANY}]]
ff1_1           | 18:52:26.769 INFO - Executing: [page load wait: 15000])
ff1_1           | 18:52:26.774 INFO - Done: [page load wait: 15000]
ff1_1           | 18:52:26.779 INFO - Executing: [get: http://www.frojoapps.com/privacy-policy])
ff1_1           | 18:52:28.370 INFO - Done: [get: http://www.frojoapps.com/privacy-policy]
ff1_1           | 18:52:28.375 INFO - Executing: [get page source])
ff1_1           | 18:52:28.388 INFO - Done: [get page source]
ff1_1           | 18:52:28.393 INFO - Executing: [get current url])
ff1_1           | [Parent 12282] WARNING: pipe error (55): Connection reset by peer: file /builds/slave/m-rel-l64-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 322
ff1_1           | [Parent 12282] WARNING: pipe error (48): Connection reset by peer: file /builds/slave/m-rel-l64-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 322
ff1_1           | 
ff1_1           | ###!!! [Parent][MessageChannel] Error: (msgtype=0x2C0085,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
ff1_1           | 

+1

+1

Guys there is already a +1 Github's built-in functionality so there is no need to pollute the comments with +1.

Regarding this issue, I've seen a similar errors for a while with no impact in my tests execution, for example using Firefox 52.0.2, Selenium 3.3.1 and without docker-compose:

firefox_driver.log:[Child 668] ###!!! ABORT: Aborting on channel error.: file /builds/slave/m-rel-l64-00000000000000000000/build/src/ipc/glue/MessageChannel.cpp, line 2143

also:

firefox_driver.log:###!!! [Child][MessageChannel] Error: (msgtype=0xE40003,name=PTexture::Msg_Destroy) Channel error: cannot send/recv

Is indeed annoying to see this without knowing why is happening however I believe this issue belongs to geckodriver, not docker-selenium, see for example:
https://github.com/mozilla/geckodriver/issues/210

@sourcerer-mike could you move this issue to geckodriver ?

@elgalu I guess there's no +1 feature yet with GitHub (at least not that I am aware of). But yes, people should use reactions such as thumps up, thumbs down etc to vote on the issue or a comment instead of adding new +1 comments.

those reactions "are" the +1 馃憤

Completely reproduceable -- browsing through an SSL Forwarding, even to localhost, expresses teh bug: This appeared in 52, with the E10 co-process addition

[Parent 3760] WARNING: pipe error (88): Connection reset by peer: file /builddir/build/BUILD/firefox-52.2.0/firefox-52.2.0esr/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 322

!!! [Parent][MessageChannel] Error: (msgtype=0x2C0085,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv


workaround is to disable remote autostart:
in:
about:config
set (historical mode):

browser.tabs.remote.autostart = false
browser.tabs.remote.autostart.2 = false

https://support.ant.com/hc/en-us/articles/115000513446-Firefox-51-Multi-Process

The latter one was silently 'enabled' and causes lockups, and when disabled the 'noise' quoted


Privacy Badger stable from the EFF site can also cause lockups creating this noise

Selenium is not the problem. I get this error in a pure firefox session in docker:

[Parent 1] WARNING: pipe error (61): Connection reset by peer: file /build/firefox-qZqDB8/firefox-55.0.2+build1/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 353
[Parent 1] WARNING: pipe error (90): Connection reset by peer: file /build/firefox-qZqDB8/firefox-55.0.2+build1/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 353
[Parent 1] WARNING: pipe error: Broken pipe: file /build/firefox-qZqDB8/firefox-55.0.2+build1/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 709
[Parent 1] WARNING: pipe error: Broken pipe: file /build/firefox-qZqDB8/firefox-55.0.2+build1/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 709
[Parent 1] WARNING: pipe error: Broken pipe: file /build/firefox-qZqDB8/firefox-55.0.2+build1/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 709
[Parent 1] WARNING: pipe error: Broken pipe: file /build/firefox-qZqDB8/firefox-55.0.2+build1/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 709
[Parent 1] WARNING: pipe error: Broken pipe: file /build/firefox-qZqDB8/firefox-55.0.2+build1/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 709
[Parent 1] WARNING: pipe error: Broken pipe: file /build/firefox-qZqDB8/firefox-55.0.2+build1/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 709
[Parent 1] WARNING: pipe error: Broken pipe: file /build/firefox-qZqDB8/firefox-55.0.2+build1/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 709

Using the following script for an instant temporary firefox session in Linux:

#!/bin/sh

set -e -x

tmpfile=/tmp/$(basename "$0").$$

if [ "$1" = "-p" ]; then
  profiledir="$(readlink -f "$2")/.mozilla/"
  test -d "$profiledir"
  chmod -R o+rwX "$profiledir" || sudo chmod -R o+rwX "$profiledir"
  EXTRAOPTS="$EXTRAOPTS -v $profiledir:/home/browser-user/.mozilla/"
  shift
  shift
fi

if [ "$1" = "-d" ]; then
  downloaddir="$(readlink -f "$2")/"
  test -d "$downloaddir"
  chmod o+rwX "$downloaddir"
  EXTRAOPTS="$EXTRAOPTS -v $downloaddir:/home/browser-user/Downloads/"
  shift
  shift
fi

test -z "$1"

docker build - <<'.e' | tee "$tmpfile"
# choose one of those FROMs:
#FROM ubuntu:16.04
#FROM ubuntu:16.10
FROM ubuntu:17.04

RUN apt-get update \
 && apt-get install -y \
    xauth \
    firefox \
    wget        \
 && apt-get clean

# Replace 1000 with your user / group id
RUN export uid=1000 gid=1000 \
 && mkdir -p /home/browser-user \
 && echo "browser-user:x:${uid}:${gid}:browser-user,,,:/home/browser-user:/bin/bash" >> /etc/passwd \
 && echo "browser-user:x:${uid}:" >> /etc/group \
 && chown ${uid}:${gid} -R /home/browser-user

ENV LIBGL_ALWAYS_SOFTWARE 1
ENV LIBGL_DEBUG verbose
ENV QT_X11_NO_MITSHM 1

USER browser-user
ENV HOME /home/browser-user
CMD [ "/usr/bin/firefox", "--no-remote" ]
.e

lastline="$(tail -n1 "$tmpfile")"
imageid="${lastline#Successfully built }"
[ "$lastline" != "$imageid" ]

xhost +SI:localuser:#1000

docker run --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $XAUTHORITY:/tmp/.Xauthority $EXTRAOPTS -e XAUTHORITY=/tmp/.Xauthority "$imageid"

Hi.

I am getting the same error. I am running selenium/node-firefox:3.7.1 with FF 57 version inside. I have hub and one node on AWS with ECS. When I try to run my tests with webdriverio, I see success request for session but as soon as the FF profile is set and the node is ready to run the tests, i get error:

1511864307846   Marionette  DEBUG   Received DOM event "beforeunload" for "about:blank"
1511864308220   Marionette  DEBUG   Received DOM event "pagehide" for "about:blank"
1511864308220   Marionette  DEBUG   Received DOM event "unload" for "about:blank"
[Parent 635, Gecko_IOThread] WARNING: pipe error (28): Connection reset by peer: file /builds/worker/workspace/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 353
###!!! [Parent][MessageChannel] Error: (msgtype=0x420017,name=PHttpChannel::Msg_DeleteSelf) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x420017,name=PHttpChannel::Msg_DeleteSelf) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x420017,name=PHttpChannel::Msg_DeleteSelf) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x420017,name=PHttpChannel::Msg_DeleteSelf) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x150083,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
A content process crashed and MOZ_CRASHREPORTER_SHUTDOWN is set, shutting down
1511864308946   addons.xpi  DEBUG   Calling bootstrap method shutdown on [email protected] version 1.1
1511864308946   addons.xpi  DEBUG   Calling bootstrap method shutdown on [email protected] version 76.1
1511864308947   addons.xpi  DEBUG   Calling bootstrap method shutdown on [email protected] version 19.2.0
1511864308950   addons.xpi  DEBUG   Calling bootstrap method shutdown on [email protected] version 1.0
1511864308951   addons.xpi  DEBUG   Calling bootstrap method shutdown on [email protected] version 1.0
1511864308951   addons.xpi  DEBUG   Calling bootstrap method shutdown on [email protected] version 0.9.6
1511864308951   addons.xpi  DEBUG   Calling bootstrap method shutdown on [email protected] version 1.0.5
1511864308951   addons.xpi  DEBUG   Calling bootstrap method shutdown on [email protected] version 3.05
1511864308951   addons.xpi  DEBUG   Calling bootstrap method shutdown on [email protected] version 2.0
1511864308952   addons.xpi  DEBUG   Calling bootstrap method shutdown on [email protected] version 2017.11.07.1100-7f4e3634
10:18:29.021 INFO - To downstream:
{
    "value": {}
}
1511864309038   addons.manager  DEBUG   shutdown
1511864309039   addons.manager  DEBUG   Calling shutdown blocker for XPIProvider
1511864309039   addons.xpi  DEBUG   shutdown
1511864309039   addons.xpi-utils    DEBUG   shutdown
1511864309039   addons.manager  DEBUG   Calling shutdown blocker for LightweightThemeManager
1511864309039   addons.manager  DEBUG   Calling shutdown blocker for GMPProvider
1511864309040   addons.manager  DEBUG   Calling shutdown blocker for PluginProvider
1511864309040   addons.manager  DEBUG   Calling shutdown blocker for PreviousExperimentProvider
1511864309041   DeferredSave.webext.sc.lz4  DEBUG   Flush called while data is dirty
1511864309044   DeferredSave.webext.sc.lz4  DEBUG   Starting write
1511864309046   addons.manager  DEBUG   Async provider shutdown done
1511864309048   DeferredSave.webext.sc.lz4  DEBUG   Write succeeded
*** UTM:SVC TimerManager:registerTimer called after profile-before-change notification. Ignoring timer registration for id: telemetry_modules_ping
10:18:29.112 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@abab4c1

I've tried to set security.sandbox.content.syscall_whitelist to 16, but that did not help.

Someone having an idea what it could be?

Best regards.

It may be related to the shm settings explained there : https://github.com/SeleniumHQ/docker-selenium
docker run :
docker run -d -p 4444:4444 --shm-size 2g

or docker compose :

firefox1:
  image: selenium/node-firefox-debug:3.8.1
  shm_size: 2g

@pascalheraud For me, --shm-size 2g solved the problem (btw --shm-size= without argument, which defaults to 64m, is not enough for firefox). The question is now: is it also solved for @ScreamingDev?

Thanks for your comments @pascalheraud @daald!
We didn't have so much time to check this so your help is super appreciated.

Seems that it could be the solution for this issue then, I'll keep the issue open for a few days in case more feedback is provided. If everything looks fine, I'll close it.

Closing this one, feel free to reopen in case problems still happen.

I'm having a similar problem with the latest node-firefox image. --shm-size 2g did not work for me.
19:20:37.153 INFO - To downstream: {"value": {}} 19:20:37.167 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@23b5eeda 19:20:37.167 INFO - Handler thread for session 413e672e-ddc4-4ec0-a8ce-b049152248e5 (firefox): Executing POST on /session/413e672e-ddc4-4ec0-a8ce-b049152248e5/element (handler: ServicedSession) 19:20:37.170 INFO - To upstream: {"value":"/html/body/div[@class \u003d \u0027container-fluid\u0027]//div[@class \u003d \u0027span7\u0027]","using":"xpath"} 19:20:37.180 INFO - To downstream: {"value":{"error":"no such element","message":"Unable to locate element: /html/body/div[@class = 'container-fluid']//div[@class = 'span7']","stacktrace":"WebDriverError@chrome://marionette/content/error.js:235:5\nNoSuchElementError@chrome://marionette/content/error.js:463:5\nelement.find/</<@chrome://marionette/content/element.js:291:16\n"}} 19:20:37.229 INFO - Found handler: org.openqa.selenium.remote.server.ServicedSession@23b5eeda 19:20:37.230 INFO - Handler thread for session 413e672e-ddc4-4ec0-a8ce-b049152248e5 (firefox): Executing DELETE on /session/413e672e-ddc4-4ec0-a8ce-b049152248e5 (handler: ServicedSession) [Child 113, Chrome_ChildThread] WARNING: pipe error (17): Connection reset by peer: file /builds/worker/workspace/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 353 19:20:37.420 INFO - To downstream: {"value": {}} 19:20:37.443 INFO - Removing session org.openqa.selenium.remote.server.ServicedSession@23b5eeda 19:20:37.457 INFO - To downstream: {"value":{"error":"session not created","message":"Tried to run command without establishing a connection","stacktrace":"stack backtrace:\n 0: 0x4edb3c - backtrace::backtrace::trace::hc4bd56a2f176de7e\n 1: 0x4edb72 - backtrace::capture::Backtrace::new::he3b2a15d39027c46\n 2: 0x4409a1 - webdriver::error::WebDriverError::new::h81babdd86c977032\n 3: 0x4280ea - <webdriver::server::Dispatcher<T, U>>::run::h2119c674d7b88193\n 4: 0x4029b9 - std::sys_common::backtrace::__rust_begin_short_backtrace::h21d98a9ff86d4c25\n 5: 0x40be65 - std::panicking::try::do_call::h5cff0c9b18cfdbba\n 6: 0x5e6a6c - panic_unwind::__rust_maybe_catch_panic\n at /checkout/src/libpanic_unwind/lib.rs:99\n 7: 0x41eb22 - <F as alloc::boxed::FnBox<A>>::call_box::h413eb1d9d9f1c473\n 8: 0x5df13b - alloc::boxed::{{impl}}::call_once<(),()>\n at /checkout/src/liballoc/boxed.rs:692\n - std::sys_common::thread::start_thread\n at /checkout/src/libstd/sys_common/thread.rs:21\n - std::sys::imp::thread::{{impl}}::new::thread_start\n at /checkout/src/libstd/sys/unix/thread.rs:84"}}

I'm still having this issue, even with shm_size: 2g and

volumes:
      - /dev/shm:/dev/shm

in my docker compose.

selenium-firefox_1  | 1520249169195 Marionette  INFO    Listening on port 42819
selenium-firefox_1  | 11:26:09.755 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
selenium-firefox_1  | 11:26:09.760 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 2d0bf949-c0a4-47cc-b3e2-3cb76b7c71f1 (org.openqa.selenium.firefox.GeckoDriverService)
selenium-firefox_1  | [Child 870, Chrome_ChildThread] WARNING: pipe error (15): Connection reset by peer: file /builds/worker/workspace/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 353
selenium-firefox_1  | [Child 870, Chrome_ChildThread] WARNING: pipe error (3): Connection reset by peer: file /builds/worker/workspace/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 353
selenium-firefox_1  | 11:26:17.893 INFO [ActiveSessions$1.onStop] - Removing session 2d0bf949-c0a4-47cc-b3e2-3cb76b7c71f1 (org.openqa.selenium.firefox.GeckoDriverService)
selenium-hub_1      | 11:26:17.897 INFO [TestSlot.getNewSession] - Trying to create a new session on test slot {server:CONFIG_UUID=1b28719f-b80a-43f0-95b4-8e51654daa07, seleniumProtocol=WebDriver, browserName=firefox, maxInstances=1, moz:firefoxOptions={log={level=info}}, platformName=LINUX, version=58.0.2, applicationName=, platform=LINUX}
selenium-hub_1      | 11:26:17.906 INFO [RequestHandler.process] - Got a request to create a new session: Capabilities {browserName: firefox, handlesAlerts: true, javascriptEnabled: true, locationContextEnabled: true, loggingPrefs: org.openqa.selenium.logging..., maxInstances: 4, requestOrigins: {name: webdriverio, url: http://webdriver.io, version: 4.11.0}, rotatable: true, specs: [./src/test/specs/**/*.js]}
selenium-firefox_1  | 11:26:18.140 INFO [ActiveSessionFactory.apply] - Capabilities are: Capabilities {browserName: firefox, handlesAlerts: true, javascriptEnabled: true, locationContextEnabled: true, loggingPrefs: org.openqa.selenium.logging..., maxInstances: 4, requestOrigins: {name: webdriverio, url: http://webdriver.io, version: 4.11.0}, rotatable: true, specs: [./src/test/specs/**/*.js]}
selenium-firefox_1  | 11:26:18.144 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)
selenium-firefox_1  | 1520249178181 geckodriver INFO    geckodriver 0.19.1
selenium-firefox_1  | 1520249178195 geckodriver INFO    Listening on 127.0.0.1:26419
router_1            | 172.27.0.4 - - [05/Mar/2018:11:26:18 +0000] "GET /images/static/boomerang-tracker.png?nt_red_cnt=0&nt_nav_type=1&nt_nav_st=1520249175102&nt_red_st=0&nt_red_end=0&nt_fet_st=1520249175117&nt_dns_st=1520249175117&nt_dns_end=1520249175117&nt_con_st=1520249175117&nt_con_end=1520249175117&nt_req_st=1520249175118&nt_res_st=1520249175363&nt_res_end=1520249175384&nt_domloading=1520249175412&nt_domint=1520249176059&nt_domcontloaded_st=1520249176059&nt_domcontloaded_end=1520249177874&nt_domcomp=1520249178239&nt_load_st=1520249178239&nt_load_end=1520249178239&nt_unload_st=1520249175389&nt_unload_end=1520249175389&nt_spdy=0&nt_cinf=http%2F1.1&nt_first_paint=1520249175.892&rt.start=navigation&rt.tstart=1520249175102&rt.bstart=1520249175880&rt.end=1520249178252&t_resp=261&t_page=2889&t_done=3150&t_other=t_domloaded%7C2772&r=&u=http%3A%2F%2Frouter%3A4002%2Fplace%2Fclapham-barbers%2F%3FshouldShowHighlightedServices%3Dtrue&v=0.9&vis.st=visible&ua.plt=Linux%20x86_64&ua.vnd=Google%20Inc.&platform=DESKTOP&version=1.226.0&ruid=b8650639-27d2-4373-9610-b5bde655687d&hash= HTTP/1.1" 404 200 "http://router:4002/place/clapham-barbers/?shouldShowHighlightedServices=true" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36"
selenium-firefox_1  | 1520249178537 mozrunner::runner   INFO    Running command: "/usr/bin/firefox" "-marionette" "-profile" "/tmp/rust_mozprofile.iuUT7TAnBP6s"
selenium-firefox_1  | 1520249179776 Marionette  INFO    Enabled via --marionette
selenium-hub_1      | 11:26:21.502 INFO [RequestHandler.process] - Got a request to create a new session: Capabilities {browserName: firefox, handlesAlerts: true, javascriptEnabled: true, locationContextEnabled: true, loggingPrefs: org.openqa.selenium.logging..., maxInstances: 4, requestOrigins: {name: webdriverio, url: http://webdriver.io, version: 4.11.0}, rotatable: true, specs: [./src/test/specs/**/*.js]}
selenium-firefox_1  | 1520249184983 Marionette  INFO    Listening on port 41985
selenium-firefox_1  | 11:26:25.340 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
selenium-firefox_1  | 11:26:25.344 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session ef5855a7-d0ca-4e1e-ac84-d4116104a164 (org.openqa.selenium.firefox.GeckoDriverService)

After this, no more tests work on Firefox.

It is happening with 3.10.0-argon but it was also happening with 3.9.1

@anto-wahanda It's probably better not to mount /dev/shm. Did you try without?

Originally I wasn鈥檛 mounting it, but then I added it as per documentation as I was getting crashes very often. What is the recommendation? Mount? Not mount? Set shm_size?

AFAIK, shm_size=2g sets up shm in the separate namespace of the container, with everything necessary, including the mount. so it doesn't share with the host (in fact, I saw some interaction which shouldn't happen, when starting firefox without --no-remote).
If you bind-mount /dev/shm at the same time, you overwrite this behaviour. in best case, you bypass the shm_size=2g completely, in worst case, you have an irritating mixture for the application, where syscalls still use the private namespace but /dev/shm accesses the host's namespace. Personally, I never mounted /dev/shm and since I set shm_size=2g, it works quite stable.

extract from docker run --help:

  --shm-size string                       Size of /dev/shm, default value is 64MB

Thanks,--shm-size=2g solved my issue.

docker run --shm-size=2g -it ...

this also solved my problem for selenium + chrome.

I've experianced this problem too, but only when using a firefox profile. If running without a profile in my firefox options, it works just fine. Here is my compose json:

version: '3.6'
services:
  selenium-hub:
    image: selenium/hub:latest
    ports:
      - "4444:4444"
    environment:
      - GRID_NEW_SESSION_WAIT_TIMEOUT=600
      - GRID_CLEAN_UP_CYCLE=5000
      - GRID_BROWSER_TIMEOUT=300
      - GRID_TIMEOUT=300
    deploy:
      placement:
        constraints:
          - node.role == manager
      resources:
        limits:
          cpus: '0.5'
          memory: 512M
    networks:
      selenium_net:
  selenium-firefox:
    image: selenium/node-firefox:latest
    entrypoint: bash -c 'SE_OPTS="-host $$HOSTNAME" /opt/bin/entry_point.sh'
    build:
      context: .
      shm_size: '2gb'
    environment:
      - HUB_HOST=selenium-hub
      - HUB_PORT=4444
    ports:
      - 5555:5555
    deploy:
      replicas: 10
      resources:
        limits:
          cpus: '0.25'
          memory: 768M
        reservations:
          cpus: '0.25'
          memory: 768M
    networks:
      selenium_net:
    volumes:
     - "/tmp/firefox_profiles:/tmp/firefox_profiles"
networks:
  selenium_net:
    driver: overlay

This is running under docker swarm.

The profile was created on the command line using firefox -CreateProfile Selenium it was created on the same OS that will be used by the docker containers running firefox. The profile itself is empty, but I'm assuming that isn't a problem

@taroquu I think you should focus on shm_size, and it seems it is on the wrong location, as "build" is not the step which causes problems. unfortunately, I can't tell you where and if there is a runtime parameter in this config format

volumes: - /dev/shm:/dev/shm
@daald I've tried which didn't help either.

@taroquu no, /dev/shm bypasses shm_size, see https://github.com/SeleniumHQ/docker-selenium/issues/388#issuecomment-370609607

What I mean:

  • build stage: you have shm_size, but it's the wrong stage
  • run stage: this is where your error happens, and there's no shm_size option in your file

disclaimer: I don't know docker swarm

still happens to me with shm and mem set to 8gb for a docker container after selenium has been running for about an hour.

I wonder if most of these problems can be subverted by implementing more of a compostable infrastructure.

i'm willing to bet that most of you folks have these nodes running for a long time. probably idling and waiting for a session. i'm also willing to bet that you will let the test run, then kick off another test against the same node.

this is an anti-pattern of the microservices architecture. try implementing a more compostable node infrastructure. a more, "one-and-done" type of strategy.

I recently read about Testcontainers. They also have a selenium module. The idea is to start a new container for each test class, which doesn't really solve the problem but makes _your_ test more reproducible and stable. Personally, I think your problem is more caused by the memory limit. Back in the days when I used firefox as my primary browser, I sometimes had a usage of more than 2GB. Which was really a lot for that time. Today, I'm sure it's not less.
I will for sure use this tool for my next project. Unfortunately, It only supports pure docker and not kubernetes for now.
Btw would probably be interesting to know how they configured this container, to make it stable...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

geekdave picture geekdave  路  4Comments

NeilJ247 picture NeilJ247  路  6Comments

matthewsamari picture matthewsamari  路  4Comments

lluisteamcmp picture lluisteamcmp  路  6Comments

westlakem picture westlakem  路  5Comments