aerokube / selenoid

Selenium Hub successor running browsers within containers. Scalable, immutable, self hosted Selenium-Grid on any platform with single binary.
https://aerokube.com/selenoid/latest/
Apache License 2.0
2.6k stars 323 forks source link

Failed to create secure directory (/home/selenium/.config/pulse): Permission denied #374

Open ash0080 opened 6 years ago

ash0080 commented 6 years ago
2018-03-16T09:05:45.622612898Z 1521191145622    Marionette  DEBUG   Received DOM event "DOMContentLoaded" for "http://chn.lottedfs.com/kr/product/productDetail?prdNo=10001903970"
2018-03-16T09:07:11.658001489Z 2018/03/16 17:07:11 http: proxy error: context canceled
2018-03-16T09:07:13.489359165Z 2018/03/16 17:07:13 http: proxy error: context canceled
2018-03-16T09:07:20.721212198Z 1521191240721    Marionette  DEBUG   Received DOM event "pageshow" for "http://chn.lottedfs.com/kr/product/productDetail?prdNo=10001903970"
2018-03-16T09:07:20.725788412Z 1521191240725    webdriver::server   DEBUG   <- 200 OK {"value": {}}
2018-03-16T09:07:20.731031964Z 1521191240728    webdriver::server   DEBUG   -> POST /session/1465d5e7-8df5-42ad-b23e-83503e18ed8c/elements {"using":"css selector","value":".buyBtn"}
2018-03-16T09:07:20.762559770Z 1521191240762    webdriver::server   DEBUG   <- 200 OK {"value":[{"element-6066-11e4-a52e-4f735466cecf":"647930ce-bfa4-40e4-961f-10aaff4d4b61"}]}
2018-03-16T09:07:20.767192991Z 1521191240765    webdriver::server   DEBUG   -> POST /session/1465d5e7-8df5-42ad-b23e-83503e18ed8c/url {"url":"http://chn.lottedfs.com/kr/product/productDetail?prdNo=10002323760"}
2018-03-16T09:07:20.777808416Z 1521191240777    Marionette  DEBUG   Received DOM event "beforeunload" for "http://chn.lottedfs.com/kr/product/productDetail?prdNo=10001903970"
2018-03-16T09:07:21.682966574Z 1521191241682    Marionette  DEBUG   Received DOM event "pagehide" for "http://chn.lottedfs.com/kr/product/productDetail?prdNo=10001903970"
2018-03-16T09:07:21.688238320Z 1521191241688    Marionette  DEBUG   Received DOM event "unload" for "http://chn.lottedfs.com/kr/product/productDetail?prdNo=10001903970"
2018-03-16T09:07:22.432351279Z Failed to create secure directory (/home/selenium/.config/pulse): Permission denied
2018-03-16T09:07:22.455430804Z fork(): Operation not permitted
2018-03-16T09:07:22.487724354Z Failed to create secure directory (/home/selenium/.config/pulse): Permission denied
2018-03-16T09:07:22.487753847Z fork(): Operation not permitted
2018-03-16T09:07:22.487757520Z Failed to create secure directory (/home/selenium/.config/pulse): Permission denied
2018-03-16T09:07:22.487760597Z fork(): Operation not permitted

run multiple browser instances will logs this error, only the first docker container will not logs error,

for example

CONTAINER ID        IMAGE                         COMMAND                  CREATED             STATUS              PORTS                    NAMES
2ea10865c3b9        selenoid/firefox:58.0         "/bin/sh -c /entrypo…"   9 seconds ago       Up 8 seconds        4444/tcp                 focused_boyd
5ba5dc05050f        selenoid/firefox:58.0         "/bin/sh -c /entrypo…"   9 seconds ago       Up 8 seconds        4444/tcp                 vigorous_mccarthy
74cbf68aa4c1        aerokube/selenoid:1.5.2       "/usr/bin/selenoid -…"   43 minutes ago      Up 43 minutes       0.0.0.0:4445->4444/tcp   selenoid
c97843a0f61b        aerokube/selenoid-ui:v1.5.6   "/selenoid-ui --sele…"   About an hour ago   Up About an hour    0.0.0.0:8080->8080/tcp   selenoid-ui

one firefox with error, one not this permission error will trigger timeout error quite possibly.

vania-pooh commented 6 years ago

@ash0080 thank you for the feedback. Seems to be permissions issue. Either because selenium user is not in some pulseaudio group or because pulse user has no permissions in /home/selenium directory.

ash0080 commented 6 years ago

@vania-pooh Is this '/home/selenium/.config/pulse' a path in container? Any way to quick fix it?

vania-pooh commented 6 years ago

@ash0080 will try to build Firefox 59 image with potential fix.

vania-pooh commented 6 years ago

@ash0080 unfortunately can't reproduce this issue. Could you provide an example scenario how to reproduce it?

ash0080 commented 6 years ago

ubuntu 16.04 64bit / 1 core vps

./cm selenoid configure --browsers firefox --last-versions 1 --tmpfs 128 \
&& ./cm selenoid start --port 4445 --args "-limit 2 -service-startup-timeout 60s -session-attempt-timeout 60s -session-delete-timeout 30s -timeout 120s"
const webdriverio = require('webdriverio')
const options = {
  host: '',
  port: 4445,
  connectionRetryCount: Number.MAX_VALUE,
  sync: false,
  debug: true,
  desiredCapabilities: {
    browserName: 'firefox',
    // 'moz:firefoxOptions': {
    //   'args': ['-headless']
    // },
    maxInstances: 2,
    version: '58.0',
    unexpectedAlertBehaviour: 'accept'
  }
}

module.exports = webdriverio.remote(options)

then wrap 2 requests in a Promise.all()

vania-pooh commented 6 years ago

@ash0080 ok, two parallel requests to the same session. Let me try this.

ash0080 commented 6 years ago

@vania-pooh actually no matter parallel or sequence call will both products this error

vania-pooh commented 4 years ago

Could be related to https://github.com/aerokube/selenoid/issues/956.