Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Running Playwright on Firefox inside a Docker container always hangs forever #16491

Closed
eduter opened this issue Aug 12, 2022 · 9 comments
Closed

Comments

@eduter
Copy link

eduter commented Aug 12, 2022

Context:

  • Playwright Version: 1.25.0 (but I tried on 1.24.2 and I get the same behavior)
  • Operating System: Ubuntu inside WSL 2 (Win 10)
  • Node.js version: v16.16.0
  • Browser: Firefox

Code Snippet

I've created a repo for reproducing the bug:
https://github.com/eduter/playwright-firefox-docker

Describe the bug

It starts the container and tries to run the example test on Firefox, but then just hangs forever like this:

playwright-ff  | > playwright test example --project=firefox
playwright-ff  |
playwright-ff  | 
playwright-ff  | Running 1 test using 1 worker
playwright-ff  |
                 [1/1] [firefox] › example.spec.ts:3:1 › homepage has Playwright
 in title and get started link linking to the intro page
@rwoll rwoll added the triaging label Aug 12, 2022
@rwoll
Copy link
Member

rwoll commented Aug 12, 2022

Thanks for the repro. I'm able to also reproduce on Docker for Linux in a default GitHub Codespace.

I cleaned up some of the Docker bits in the repro, and the issue looks to be narrowed down to permission-related when using a volume mount.

With DEBUG set to pw:browser, the relevant error looks to be: pw:browser [pid=256][err] Error: Access was denied while trying to open files in your profile directory.

This only occurs if the commented out volume mount is used (https://github.com/rwoll/user-repro-playwright-firefox-docker)

@aslushnikov Do you know what constraints there are on using docker volume mounts and FF?

/cc @eatonjl in case this ends up being helpful in your investigation of #16099

@mxschmitt
Copy link
Member

Assigning to 1.26 so we file it upstream or look into it.

@hex0cter
Copy link
Contributor

I got it on mcr.microsoft.com/playwright:v1.25.0-focal too. Is it still a problem on the latest version?

@aslushnikov
Copy link
Collaborator

@hex0cter the issue with firefox misbehaving with mounts in docker should be filed upstream to Firefox; I'll appreciate if someone will build a small repro and file it to Mozilla folks for them to take a look.

@stevebaxter
Copy link

stevebaxter commented Jan 16, 2023

This isn't working for me either with the plain mcr.microsoft.com/playwright:v1.29.2-focal docker image under Jenkins - trying to run a FF test just hangs forever. Chromium and Webkit are fine.

This is what I get with DEBUG=pw:browser:

17:46:54    �[30;1mpw:browser �[0m<launching> /ms-playwright/firefox-1369/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-awi58P -juggler-pipe -silent �[30m+0ms�[0m
17:46:54    �[30;1mpw:browser �[0m<launched> pid=726 �[30m+5ms�[0m
17:46:54    �[30;1mpw:browser �[0m[pid=726][err] *** You are running in headless mode. �[30m+20ms�[0m
17:46:54    �[30;1mpw:browser �[0m[pid=726][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.0475178) [GFX1-]: glxtest: libpci missing �[30m+28ms�[0m
17:46:54    �[30;1mpw:browser �[0m[pid=726][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.0475178) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.0475758) [GFX1-]: glxtest: Unable to open a connection to the X server �[30m+0ms�[0m
17:46:54    �[30;1mpw:browser �[0m[pid=726][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.0475178) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.0475758) |[2][GFX1-]: No GPUs detected via PCI (t=0.0475894) [GFX1-]: No GPUs detected via PCI �[30m+1ms�[0m
17:46:54    �[30;1mpw:browser �[0m[pid=726][err] Unable to revert mtime: /ms-playwright/firefox-1369/firefox/fonts �[30m+32ms�[0m
17:46:54    �[30;1mpw:browser �[0m[pid=726][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. �[30m+70ms�[0m
17:46:54    �[30;1mpw:browser �[0m[pid=726][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. �[30m+1ms�[0m
17:46:54    �[30;1mpw:browser �[0m[pid=726][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. �[30m+2ms�[0m
17:46:54    �[30;1mpw:browser �[0m[pid=726][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. �[30m+2ms�[0m
17:46:54    �[30;1mpw:browser �[0m[pid=726][err] JavaScript error: resource://gre/modules/XULStore.jsm, line 58: Error: Can't find profile directory. �[30m+4ms�[0m
17:46:54    �[30;1mpw:browser �[0m[pid=726][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.0475178) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.0475758) |[2][GFX1-]: No GPUs detected via PCI (t=0.0475894) |[3][GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt (t=0.164347) [GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt �[30m+5ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err]  �[30m+60s�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err] (firefox-default:726): dconf-CRITICAL **: 17:47:54.718: unable to create directory '/.cache/dconf': Permission denied.  dconf will not work properly. �[30m+0ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err]  �[30m+0ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err] (firefox-default:726): dconf-CRITICAL **: 17:47:54.718: unable to create directory '/.cache/dconf': Permission denied.  dconf will not work properly. �[30m+1ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err]  �[30m+0ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err] (firefox-default:726): dconf-CRITICAL **: 17:47:54.718: unable to create directory '/.cache/dconf': Permission denied.  dconf will not work properly. �[30m+0ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err]  �[30m+1ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err] (firefox-default:726): dconf-CRITICAL **: 17:47:54.718: unable to create directory '/.cache/dconf': Permission denied.  dconf will not work properly. �[30m+0ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err]  �[30m+0ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err] (firefox-default:726): dconf-CRITICAL **: 17:47:54.719: unable to create directory '/.cache/dconf': Permission denied.  dconf will not work properly. �[30m+1ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err]  �[30m+172ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err] (firefox-default:726): dconf-CRITICAL **: 17:47:54.893: unable to create directory '/.cache/dconf': Permission denied.  dconf will not work properly. �[30m+0ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err]  �[30m+0ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err] (firefox-default:726): dconf-CRITICAL **: 17:47:54.893: unable to create directory '/.cache/dconf': Permission denied.  dconf will not work properly. �[30m+0ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err]  �[30m+0ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err] (firefox-default:726): dconf-CRITICAL **: 17:47:54.893: unable to create directory '/.cache/dconf': Permission denied.  dconf will not work properly. �[30m+0ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err]  �[30m+0ms�[0m
17:48:05    �[30;1mpw:browser �[0m[pid=726][err] (firefox-default:726): dconf-CRITICAL **: 17:47:54.893: unable to create directory '/.cache/dconf': Permission denied.  dconf will not work properly. �[30m+1ms�[0m

I was hoping the default PW Docker image wouldn't need customising to make it work!

@stevebaxter
Copy link

stevebaxter commented Jan 16, 2023

Ah, I suspect it's the same as this issue #13716. I was able to work around this using a customised Dockerfile:

# Use the Playwright Docker image, this has all the right dependencies
FROM mcr.microsoft.com/playwright:v1.29.2-focal

# Run as a specific user to work around problems with FireFox, see https://github.com/microsoft/playwright/issues/16491#issuecomment-1384375026
ENV RUNASUSER jenkins
ENV USERHOME /home/${RUNASUSER}
RUN groupadd -g 1001 -r ${RUNASUSER} && useradd --no-log-init -m -r -g ${RUNASUSER} -u 1001 ${RUNASUSER}
USER ${RUNASUSER}
WORKDIR ${USERHOME}

This sets up the right environment for the user so everything works.

@aslushnikov
Copy link
Collaborator

aslushnikov commented Jan 18, 2023

Summary: this is a Firefox upstream bug, it should be reported upstream to Firefox bug tracker. Closing since there's no action item for Playwright team here.

@stevebaxter
Copy link

@aslushnikov - is there an argument to set up the Playwright Docker image to make sure this works though?

@andrehil
Copy link

@aslushnikov I'm having the same issue when running v1.36.2-focal in OCP.
I agree with @stevebaxter that it should work out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants