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

Panagement/CliptIt crashing on Arch Linux #439

Closed
p0nce opened this issue Dec 20, 2019 · 17 comments
Closed

Panagement/CliptIt crashing on Arch Linux #439

p0nce opened this issue Dec 20, 2019 · 17 comments
Labels
Bug Reproduced bug. Linux This issue is Linux-specific.

Comments

@p0nce
Copy link
Collaborator

p0nce commented Dec 20, 2019

Probably Panagement-related but:

Panagement + LV2 + Arch + Ardour5 => crash after a few seconds

Panagement + LV2 + XUbuntu 18.04 + Bitwig => crash after a few seconds

The plugin crashes all by itself after a few seconds. Repeatedly. Reload, wait perhaps 5 seconds doing absolutely nothing, then crashes.

@p0nce p0nce added the Unconfirmed This issue describe a bug that hasn't been reproduced yet. label Dec 20, 2019
@p0nce
Copy link
Collaborator Author

p0nce commented Dec 20, 2019

This is really looking like a bad fix inside Panagement, except one report even say:

on Arch too (Manjaro) when using Ardour5, Panagement LV2 loads with a fuzzy look (all scrambled and zagged) then violently crash (and crashes ardour).

which is something different...

@p0nce p0nce changed the title More Linux issues More Linux issues (might be 2 issues) Dec 20, 2019
@p0nce
Copy link
Collaborator Author

p0nce commented Dec 22, 2019

Lots of users are reporting normal function, except some on Arch mostly.

@p0nce
Copy link
Collaborator Author

p0nce commented Dec 30, 2019

https://forum.audacityteam.org/viewtopic.php?f=48&t=108249 Two reports of Audacity crash, this time with a trace.

@p0nce
Copy link
Collaborator Author

p0nce commented Jan 18, 2020

Bug with audacity reproduced:

 Most likely this is a multi-threaded client and XInitThreads has not been called

I just though XInitThreads was to be called by the host and not the plugin...

@p0nce
Copy link
Collaborator Author

p0nce commented Jan 18, 2020

I think our own mutex should go and we should use XLockDisplay / XUnlockDispla+ our own mutex ( in case XInitThreads wasn't called)
This way the plugin host still choose whether it uses XInitThreads or not.

@p0nce
Copy link
Collaborator Author

p0nce commented Jan 19, 2020

X11 Race regression fixed in v9.1.8. This fixed at least the Audacity crash. I suspect other crashes are due to the same race, but maybe with some Arch specifics, difficult to know without testing on Arch.

@p0nce p0nce added the Linux This issue is Linux-specific. label Jan 19, 2020
@p0nce p0nce changed the title More Linux issues (might be 2 issues) Panagement crashing on Arch Linux Jan 19, 2020
@p0nce
Copy link
Collaborator Author

p0nce commented Jan 30, 2020

Probably fixed since v9.1.8, should test when given the chance.

@psychedel
Copy link

How can I help with tests here? I use Arch

@p0nce
Copy link
Collaborator Author

p0nce commented Apr 27, 2020

Hello,

If you can build a LV2 plug-in using the latest Dplug ~master and it works in Ardour, I think will prove that Dplug plug-ins work on Arch.
You can follow the dplug tutorial here in the Wiki: https://github.com/AuburnSounds/Dplug/wiki/Getting-Started

@psychedel
Copy link

Ok, from what I've tried:
In Ardour / LV2:

  • Destructatorizer works
  • The plugin "CLIP It" could not be loaded
    See the Log window for more details (maybe)

In Reaper / VST3:

  • "CLIP It" crashes Reaper (segmentation fault)
  • Destructatorizer works

I will try more tomorrow.
P.S. Thanks for the such a wonderful project (just found it today) it's really perfect to avoid C++/Rust for VST development!

@p0nce
Copy link
Collaborator Author

p0nce commented Apr 27, 2020

Hello,

Would it work with ClipIt if you comment out the onDrawRaw method? This part is basically a recent test for Canvas-like functionnality that is very recent.

Thanks for the praise :) We're trying to stay practical

@psychedel
Copy link

Without onDrawRaw - ClipIt works as VST3 in Reaper, but screen issue in Ardour (LV2).
image

@p0nce
Copy link
Collaborator Author

p0nce commented Apr 28, 2020

Cool you found the same glitch as #467 !
Apart from the CliptIt crash (recent regression), #439 and #467 looks dupe.

@psychedel
Copy link

psychedel commented Apr 28, 2020

Ok, I'm still learning the internals of the Dplug.
But for now, I can help with testing on Linux/Windows with Reaper/Bitwig/Ardour
(hope to get some debugging environment in Linux soon, working from VS Code)

@p0nce
Copy link
Collaborator Author

p0nce commented Apr 28, 2020

Basically both bugs are the same it's a race condition in window/dplug/window/x11window.d, one of the "finer" part of the library.

@p0nce p0nce changed the title Panagement crashing on Arch Linux Panagement/CliptIt crashing on Arch Linux Oct 23, 2020
@p0nce
Copy link
Collaborator Author

p0nce commented Oct 23, 2020

Found a bug with ClipIT + Ardour6 + LDC + LV2 + debug build on Manjaro + KDE

  • instantiate twice
  • open/close one interface , then the other, it cash in XCheckEventWindow for the non-closed window

@p0nce p0nce added Bug Reproduced bug. and removed Unconfirmed This issue describe a bug that hasn't been reproduced yet. labels Oct 23, 2020
@p0nce
Copy link
Collaborator Author

p0nce commented Oct 23, 2020

To fix it, XEvent from the dead window needs to be pulled from the queue manually before the other window can call XCheckEventWindow.

diff --git a/window/dplug/window/x11window.d b/window/dplug/window/x11window.d
index ba2dcf4c..493c8180 100644
--- a/window/dplug/window/x11window.d
+++ b/window/dplug/window/x11window.d
@@ -653,8 +653,19 @@ private:
         XFreeGC(_display, _graphicGC);
         freeBackbuffer();
         XDestroyWindow(_display, _windowID);
-        unlockX11();
 
+        // We need to flush all window events from the queue that are related to this window
+        // MAYDO: the right way would be to arguably terminate the event thread with the destroy event 
+        // instead of an out of band flag. But order of destruction would have to be checked for a bit of everything.
+        XSync(_display, false);
+        XEvent event;
+        while(true)
+        {
+            Bool found = XCheckWindowEvent(_display, _windowID, windowEventMask(), &event);
+            if (!found) break;
+        }
+
+        unlockX11();
     }
 
     // this frees _graphicImage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reproduced bug. Linux This issue is Linux-specific.
Projects
None yet
Development

No branches or pull requests

2 participants