Attaching OpenGLContext under Linux cause xcb issues

Hi! Here is a minimal example of the problem I face: Source Code. Basically, I attach an OpenGLContext to a component and make that component visible.

namespace zlpanel {
    MainPanel::MainPanel(PluginProcessor &p) {
        openGLContext.attachTo(*this);
        setSize(200, 200);
    }

    MainPanel::~MainPanel() {
        openGLContext.detach();
    }

    void MainPanel::paint(juce::Graphics &g) {
        g.fillAll(juce::Colours::darkred);
    }

    void MainPanel::resized() {}
} // panel

I am using JUCE 7.0.6. And I follow the instructions to install Linux deps (see this workflow for details).

When I remove the OpenGLContext, everything goes fine (see this action). However, when I attach the OpenGLContext, the pluginval will be aborted by xcb occasionally (see this action):

[xcb] Unknown sequence number while processing reply
[xcb] You called XInitThreads, this is not your fault
[xcb] Aborting, sorry about that.
pluginval: ../../src/xcb_io.c:730: _XReply: Assertion `!xcb_xlib_threads_sequence_lost' failed.
/home/runner/work/_temp/78a3e092-1ff4-41b5-8010-b953bc77b96d.sh: line 3:  5811 Aborted                 (core dumped) ./pluginval --strictness-level 10 --verbose --validate-in-process "ZLTest_artefacts/Release/VST3/ZL Test.vst3"

Currently I am not able to locate the problem (code? building? Linux deps? … ). I would appreciate any advice :grinning:

It might be worth checking what version of libX11 you have installed. There are reports of a similar issue here, which appear to be caused by an X11 bug which is fixed in newer releases.

Got it. The version installed by the action is 1.7.5

  libx11-dev is already the newest version (2:1.7.5-1ubuntu0.2).
  libx11-dev set to manually installed.

It is older than the problematic libx11-dev version mentioned in that issue. I will try installing the lastest version later.


It seems that libx11-dev 1.7.5 the only candidate version under Ubuntu 22.04 :melting_face: I am not sure whether upgrading libx11-dev manually is a good idea.

Follow-up on this:

After upgrading to Ubuntu 23.04 (Lunar), these relevant packages are upgraded to:

ladspa-sdk:amd64/jammy 1.17-1 uptodate
libasound2-dev:amd64/lunar 1.2.8-1build1 uptodate
libcurl4-openssl-dev:amd64/lunar 7.88.1-8ubuntu1 uptodate
libfreetype6-dev:amd64/lunar 2.12.1+dfsg-4 uptodate
libglu1-mesa-dev:amd64/lunar 9.0.2-1.1 uptodate
libjack-jackd2-dev:amd64/lunar 1.9.21~dfsg-2 uptodate
libwebkit2gtk-4.0-dev:amd64/jammy-security 2.40.5-0ubuntu0.22.04.1 uptodate
libx11-dev:amd64/lunar 2:1.8.4-2 uptodate
libxcomposite-dev:amd64/jammy 1:0.4.5-1build2 uptodate
libxcursor-dev:amd64/lunar 1:1.2.1-1 uptodate
libxext-dev:amd64/jammy 2:1.3.4-1build1 uptodate
libxinerama-dev:amd64/jammy 2:1.1.4-3 uptodate
libxrandr-dev:amd64/lunar 2:1.5.2-2 uptodate
libxrender-dev:amd64/lunar 1:0.9.10-1.1 uptodate
mesa-common-dev:amd64/jammy-updates 23.0.4-0ubuntu1~22.04.1 uptodate
ninja-build:amd64/lunar 1.11.1-1 uptodate
xvfb:amd64/lunar 2:21.1.7-1ubuntu3 uptodate

Good news: the problem disappears :grinning:

Bad news?: It seems that there are some conflicts between OpenGLContext within JUCE 7.0.6 and the default libX11 under Ubuntu 22.04