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

Headless chrome does not work in servercore ltsc 2019 #219

Closed
mwfriedm opened this issue Apr 13, 2022 · 4 comments
Closed

Headless chrome does not work in servercore ltsc 2019 #219

mwfriedm opened this issue Apr 13, 2022 · 4 comments
Labels
bug Something isn't working triage New and needs attention

Comments

@mwfriedm
Copy link

Describe the bug
Google Chrome crashes on startup when running in windowservercore ltsc 2019. It is looking for dependencies from Server Media Foundation. These were available by default in windowsservercore ltsc 2016, but are not in 2019.

To Reproduce
Dockerfile:

FROM mcr.microsoft.com/windows/servercore:ltsc2019
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN Write-Host INFO: Downloading chrome...; \
  Invoke-WebRequest "https://dl.google.com/chrome/install/latest/chrome_installer.exe" -OutFile chrome_installer.exe; \
  Write-Host INFO: Installing chrome...; \
  Start-Process -Wait -NoNewWindow -FilePath chrome_installer.exe -Args '/silent /install'; \
  Remove-Item chrome_installer.exe; \
  Write-Host INFO: Completed

Build and run the image. Then, inside the container:

PS> & 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe' --headless --disable-gpu --disable-accelerated-video-decode --enable-logging --v=1
[0413/135951.607:ERROR:network_change_notifier_win.cc(226)] WSALookupServiceBegin failed with: 0
[0413/135951.623:VERBOSE1:webrtc_internals.cc(117)] Could not get the download directory.
[0413/135951.623:VERBOSE1:media_stream_manager.cc(871)] MSM::InitializeMaybeAsync([this=4A824C00])
[0413/135951.623:VERBOSE1:media_stream_manager.cc(871)] MDM::MediaDevicesManager()
[0413/135951.623:VERBOSE1:media_stream_manager.cc(871)] MSM::MediaStreamManager([this=4A824C00]))
[0413/135951.763:ERROR:network_change_notifier_win.cc(226)] WSALookupServiceBegin failed with: 0
[0413/135951.826:ERROR:dxva_video_decode_accelerator_win.cc(1461)] DXVAVDA fatal error: could not LoadLibrary: mf.dll: The specified module could not be found. (0x7E)
[0413/135951.826:ERROR:dxva_video_decode_accelerator_win.cc(1461)] DXVAVDA fatal error: could not LoadLibrary: mfplat.dll: The specified module could not be found. (0x7E)
[0413/135951.826:ERROR:dxva_video_decode_accelerator_win.cc(1461)] DXVAVDA fatal error: could not LoadLibrary: msmpeg2vdec.dll: The specified module could not be found. (0x7
E)
[0413/135951.841:ERROR:dxva_video_decode_accelerator_win.cc(1465)] DXVAVDA fatal error: could not LoadLibrary: dxva2.dll: The specified module could not be found. (0x7E)
[0413/135951.841:ERROR:dxva_video_decode_accelerator_win.cc(1469)] DXVAVDA fatal error: could not LoadLibrary: msvproc.dll: The specified module could not be found. (0x7E)

Expected behavior
Repeat the same thing, except change the base image to ltsc2016. Now it works, and chrome starts successfully in the container.

Attempted workaround: install server media foundation. It doesn't work because the source media aren't in the ltsc2019 container image.

PS > Install-WindowsFeature Server-Media-Foundation
Install-WindowsFeature: The request to add or remove features on the specified server failed.
Installation of one or more roles, role services, or features failed.
The source files could not be found.
Use the "Source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077. Error: 0x800f081f


Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
False   No             Failed         {}

Configuration:

  • Edition: Windows 10 Enterprise Version 1909 (OS Build 18363.2158)
  • Base Image being used: Windows Server Core ltsc 2016 / 2019
PS> docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.8.2)
  compose: Docker Compose (Docker Inc., v2.4.1)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Server Version: 20.10.14
 Storage Driver: windowsfilter
  Windows:
 Logging Driver: json-file
 Plugins:
  Volume: local
  Network: ics internal l2bridge l2tunnel nat null overlay private transparent
  Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog
 Swarm: inactive
 Default Isolation: hyperv
 Kernel Version: 10.0 18363 (18362.1.amd64fre.19h1_release.190318-1202)
 Operating System: Windows 10 Enterprise Version 1909 (OS Build 18363.2158)
 OSType: windows
 Architecture: x86_64

Additional context
I believe this is the same issue as these Stack Overflow questions:
https://stackoverflow.com/questions/71080844/headless-chrome-fails-in-windows-container-require-dxavda-dlls-even-when-using
https://stackoverflow.com/questions/71859631/chrome-headless-crash-on-windows

The root cause is possibly a bug in Chrome initialization and flag handling.

See here:
https://chromium.googlesource.com/chromium/src/+/master/media/gpu/windows/dxva_video_decode_accelerator_win.cc#1457

A reasonable expectation might be that the flag --disable-accelerated-video-decode would disable this initialization, and yet it does not.

@mwfriedm mwfriedm added the bug Something isn't working label Apr 13, 2022
@ghost ghost added the triage New and needs attention label Apr 13, 2022
@cwilhit
Copy link
Contributor

cwilhit commented Apr 14, 2022

This does not appear a bug so much as it is an image composition request to have this present in Server Core. Between WS2016 and WS2019 release, there were several pruning operations we took to trim down the Server Core image size (inclusion of this package must've fallen below the cutline).

Our guidance in this case would be to use the Windows Server base image for this purpose (or if this is running on WS2019, the Windows image), and if that is a nonstarter there is a documented way to do this found in #159 , specifically Michael's response here.

@cwilhit cwilhit closed this as completed Apr 14, 2022
@mwfriedm
Copy link
Author

Thank you! https://docs.microsoft.com/en-us/windows-server/administration/server-core/server-core-container-removed-roles explains that this was intentional. I guess I'll use the Windows image instead.

@kevin-sears-datacom
Copy link

This is due to missing fonts in the 2019 core base image.
Check out this repo on how to install the missing fonts

@madduci
Copy link

madduci commented Feb 14, 2024

The error persists with Windows Containers LTSC 2022.

The output error is:

PS C:\Program Files\Google\Chrome\Application> .\chrome.exe -headless
PS C:\Program Files\Google\Chrome\Application> [0214/045035.758:ERROR:network_change_notifier_win.cc(267)] WSALookupServiceBegin failed with: 0
[0214/045036.011:ERROR:network_change_notifier_win.cc(267)] WSALookupServiceBegin failed with: 0
[0214/045036.065:ERROR:mf_initializer.cc(31)] Failed to start Media Foundation, accelerated media functionality may be disabled. If you're using Windows N, see https://support.microsoft.com/en-us/topic/media-feature-pack-for-windows-10-n-may-2020-ebbdf559-b84c-0fc2-bd51-e23c9f6a4439 for information on how to install the Media Feature Pack. Error: Could not load mf.dll. The operation completed successfully. (0x0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage New and needs attention
Projects
None yet
Development

No branches or pull requests

4 participants