Question / Help Problem with running inside docker

Alik Send

New Member
Hi

First of all, thank you much for your big and really qualitative product, good architecture, documentation and code. It is really good experience in opensource for me.
Then go to subject.
I try to build small app to capture video from blackmagic card, add logo, titles etc, stream over rtmp and show output on display. I want to control it using simple web interface, configuration will be partially hardcoded partially loaded from json-file, partially added from web-interface (titles etc).
I learned API and created application that fit my needs, but I want to run it inside docker, but I have some problems with it.
I use mac os in usual life and created my app on it, but I can't run it in docker on mac os because it crashes on `obs_init_hotkeys` because it wants X-server. Ok, I can comment it and get another crash when try to reset video.
Not a problem. "Production server" will be on archlinux, so I just installed it on virtualbox vm, mounted directory from mac to vm, logged in using ssh, created monitor configuration and then ran `X vt1`. But I also can't get my app working: I have `Segmentation fault` on `Initializing OpenGL...` step. Using `printf` and `blog` "debugger" I find that it crashes in libobs-opengl –> gl-x11.c in `gl_context_create` method when calling `glXChooseFBConfig(display, DefaultScreen(display), ctx_visual_attribs, &frame_buf_config_count);`. I wrote small app on C to play with and detect and solve error.
When I tried to run builded obs inside docker it runs ok. Although no, not quite, it crashes when tried to load scenes, just after answering "No" or going through prompt to run Auto-Configuration Wizard, but it successfully (or partially successfully, see log) passed `Initializing OpenGL...` phase.
Code:
info: ---------------------------------
info: Initializing OpenGL...
info: Loading up OpenGL on adapter VMware, Inc. llvmpipe (LLVM 5.0, 256 bits)
info: OpenGL loaded successfully, version 3.3 (Core Profile) Mesa 17.2.8, shading language 3.30
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
error: glGetIntegerv(GL_MAX_TEXTURE_ANISOTROPY_MAX) failed, glGetError returned 0x500
info: ---------------------------------
info: video settings reset:
    base resolution:   800x600
    output resolution: 800x600
    downscale filter:  Bicubic
    fps:               30/1
    format:            NV12
    YUV mode:          601/Partial
So I conclude that code of UI have something, that my app haven't, I walked through the code but don't find something that that would seem to be important (on my mind) in this situation.

Also I tried different solutions.
Due to https://www.opengl.org/discussion_boards/showthread.php/194751-i-MX6-glXChooseFBConfig-Segmentation-Fault-(Segfault)?p=1275981&viewfull=1#post1275981 I tried change `ctx_visual_attribs` to `[None]` or `NULL`.
I tried to set `gpu_conversion = false` (on mac I used `true`).
I tried run container with `--device /dev/dri`.
I tried to run not with simple X but with xfce.

None of this helps. So I look forward to your help.
I posted my code on github: https://github.com/aliksend/obs-proof (yes, CMakeLists stealed from UI with my truncations). You can build it with `docker build . -t obs_proof`, run my app with `docker run --rm -it -e DISPLAY=:0 -v /tmp/.X11-unix:/tmp/.X11-unix obs_proof` and obs with `docker run --rm -it -e DISPLAY=:0 -v /tmp/.X11-unix:/tmp/.X11-unix obs_proof ./obs`.
 
Last edited:

Alik Send

New Member
I tried to build it on archlinux host directly (not inside docker) and when running get same result as with obs UI – same errors as in log above, but it successfully runs.
But when I build that code and run inside docker I got segfault.
 

kurufu

Member
Basically you are doing two unsupported things. Running on a VM is not supported as VM's have usually non-existent and when extant absolutely terrible buggy implementations of 3D graphics which OBS requires. Secondly OBS does not support running under any container system.

If you are trying to do either of these or in your case both. You are on your own for figuring out whats a bug in your VM's graphics implementation and what is a bug in docker or any other containerization or how to configure either of them appropriately.
 

Alik Send

New Member
Thank you for your answer

I tried to run it in real machine with archlinux and got same result (my program didn't work but I'm not sure at what stage). I use VM only for testing purposes. If someone can give me tips on what to do to solve the problem, I can try do it in real machine.
I understand that OBS not intended to work in this environment, but I ran official UI and libobs successfully initialized with it. I just want to find difference in mine and UI implementation that can affect and I ask forum to help me in this search.
I don't want to use 3D graphics or other difficult operations in my program. Also as I know obs uses X-server to work with graphics card and I run X-server on real machine and provide `/tmp/.X11-unix` volume to container to work with so I can utilize graphics as the host machine allows.
Anyway, I think I can solve problems or abandon the idea of running in a container, except problems that goes deep into opengl and isn't happen in code like mine.

So your guess that problem is in VM's graphics. Ok I'll try to run my code in real machine again and find problem part and provide result as soon as I can.
Thank you
 

antou

New Member
Hi all,

Bumping because I have the same problem, both inside a VM and using a fresh Ubunty 17.10 host.
So the obs app works, Alik's program segfaults. I wish there was a very basic cpp example program included in libobs...

Cheers
 

antou

New Member
Alik,

Agreed, the documentation is quite good, but there is something that works in the UI app but not when building a headless app from scratch.

I also tried running your application (obs-cheadless from obs-proof) on my Linux host, but I also get the segfault inside obs_reset_video(). Did you do anything special to make it run on your host OS ?

Cheers
 

Alik Send

New Member
Antou,

You should have effects (libobs/obs.c:256 and further in `obs_init_graphics` function) on paths where libobs will look for, also you should have compiled plugins and it's data (path to each you will specify while calling obs_open_module but I don't remember why but I moved plugins to default location (/usr/local/share/obs if I'm not mistaken), may be because of defined constants like OBS_DATA_PATH that defined via cmake).
But if you don't do that I wrote out you'll get OBS_VIDEO_FAIL result from obs_reset_video but not segfault.
 
Top