How to debug mesa driver problem with Xvfb, headless-gl when packaging for AWS Lambda

左心房为你撑大大i 提交于 2020-04-17 21:44:34

问题


I am stuck at debugging the packaging of a custom Xvfb built with headless-gl (ThreeJS and WebGL) for AWS Lambda. Potentially I am missing some intricacies of installing drivers or just a required library and I cannot get useful logs.

I am trying to run node with ThreeJS/WebGL in a headless environment. The purpose of this is to package it all into an AWS Lambda function. Currently, I am testing in Docker with a clean lambci/lambda:build-nodejs12.x image (which should resemble amazon linux 2) and everything works in a clean environment which has the binaries shared in /var/task/bin and /var/task/lib, if I run:

yum install -y mesa-dri-drivers

prior to running:

xvfb-run --server-args "-ac -screen 0, 1024x1024x24" node_modules/.bin/coffee myscript.coffee -i ./test.png -o ./out.png

I have built Xvfb, similar to https://github.com/nisaacson/aws-lambda-xvfb (some more steps due to missing dependencies and more recent versions of everything) and I know that my coffee script runs via node and that everything works. However, without installing the mesa drivers, things start to go wrong. I tried to package them in lib via yumdownloader, sharing them with the environment, following instructions here: https://aws.amazon.com/premiumsupport/knowledge-center/lambda-linux-binary-package/ and here: https://stackoverflow.com/a/58750659/4556546 and added the directory with the copied shared binaries in front of the existing LD_LIBRARY_PATH.

Despite all this packaging, I get an error message (via the xvfb-run command):

THREE.WebGLRenderer: TypeError: _canvas.getContext is not a function
events.js:200
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read property 'getExtension' of undefined

This traces back to my coffee script:

gl = require('gl')(width, height) 

Where gl is null in the non-working case. I think this just indicates that no WebGL context could be created. What I am missing is why that would be. My guess is that a library is missing, but I do not know how to find out which.

When running with:

xvfb-run -e myLog.txt …

I do not get anything useful either, Xvfb seems to start fine, no entries that I do not get in the working scenario.

Questions:

  1. Do I need to do something differently when packaging a driver installation?
  2. Is there a way to see further log information from Xvfb?

Update:

Installing glxinfo and running:

xvfb-run -s "-screen 0 640x480x24" glxinfo

Leads to:

name of display: :99
Error: couldn't find RGB GLX visual or fbconfig

While it works on the system with the mesa drivers installed via yum. All I could find online is that the message above indicates a problem with the drivers, I do not see how to fix it though. I tried running strace and inotifywait to see which libraries are accessed in the working/non-working case, it showed me a couple that might have been missing, but copying them did not help.

来源:https://stackoverflow.com/questions/60083999/how-to-debug-mesa-driver-problem-with-xvfb-headless-gl-when-packaging-for-aws-l

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!