osxmidi / LinVst

Linux Windows vst wrapper/bridge
GNU General Public License v3.0
682 stars 41 forks source link

Version 2.55 Crashing Reaper with Kernel 5.2.2 #90

Closed Ogami-Z closed 5 years ago

Ogami-Z commented 5 years ago

I just had a chance to check out the updated version & it does initially seem to fix the problem. That is until you open & close a plugin in Reaper 3 or 4 times then Reaper freezes & has to be killed along with any still running wine or linvst in the background.

Tested with Kontakt 5, Amplitube 4 & various fabfilter plugins. Just on the off chance would it have anything to do with the lin-vst-servertrack.exe lin-vst-servertrack.exe.so. I noticed there aren't any others included in 2.55like previous versions.

For now I've had to revert back from kernel 5.2.2 to 5.1.19 & reconvert all plugins with linvst 2.32.

osxmidi commented 5 years ago

From what I've read, kernel 5.2 has new memory handling (and other changes) and I think that that is maybe incompatible with what the Wine binaries are doing at the moment.

Maybe Wine will work it out in a future version.

I'll also look into possible workarounds in the meantime.

osxmidi commented 5 years ago

I've made some changes for a possible workaround.

It seems to be ok with the 5.2 kernel on my system.

Ogami-Z commented 5 years ago

Okay thanks, I'll test it out asap & get back to you.

Ogami-Z commented 5 years ago

So the plot thickens... The same thing was happening even after version 2.6 with kernel 5.2.2. So I thought I'd also check with a different DE than i3gaps & tested with xfce4. & the problem does seem to be fixed. So somethings happening with wine, kernel 5.2.2 & i3wm. Everything worked fine in i3 before 5.2.2.

Then I load a heavily win vst laden project in xfce4 which loads fine but on playback the looped percussion running in Kontakt instances is all out of time with the bpm of the project. This particular project played just fine the last time I checked in kernel 5.1.19.

So I'm thinking this is mostly down to the new memory handing of wine because as you know Kontakt instruments are running from ram. going to have to revert back now & hope this particular project runs fine again. Hopefully wine will get sorted soon.

Ogami-Z commented 5 years ago

Just checked again with linvst 2.35 & kernel 5.1.19 and timing is back to normal.

osxmidi commented 5 years ago

I don't know if it's related but I changed the timeinfo routines in LinVst 2.52 and up.

Did LinVst 2.52 (or up) work ok with kernels lower than 5.2? (If you tried that combo)

You can go back to the old time by deleting the -DNEWTIME entries from the Makefile (if you make LinVst)

Kernel 5.2 was causing Wine/LinVst memory segfault errors, but the time problem might be different.

Ogami-Z commented 5 years ago

I've been happily using version 2.35 up until this point so never checked any version below 2.55 until trying kernel 5.2.2. I'll check that out as soon as I can. Gotta work on some music for a while

Ogami-Z commented 5 years ago

Okay I've compiled the latest version on kernel 5.2.4. with the -DNEWTIME entries removed from the makefile. the Timings still not right. Whats happening is the timing is sticking at 120bpm no matter what you change Reapers tempo to. Kernel 5.1 is now EOL so there's only the 5.2 option soon or fall back to 4.19, 5.0RT

Do you have any idea what might be causing the freezing with Reaper/Linvst, kernel 5.2 & i3WM? This is my preferred DE & I don't want to have to go back to xfce4.

osxmidi commented 5 years ago

Unfortunately, I have no idea.

LinVst gets the timeinfo from Reaper (or the DAW) and passes it on to the plugin.

Maybe it's something to do with the kernel you have got and Reaper.

The Liquorix kernel is up to 5.2, so if you have a Debian based system then you could try that and see what happens.

Or try to track down an alternative 5.2 kernel for your distro.

Ogami-Z commented 5 years ago

I've tested version 2.54 with kernels 5.1.21, 50-rt & have ruled out the timing issue with anything changes made in this version. Timing seems to be fine so there's something going on with wine & kernel 5.2.

But v2.54 still causes freezing for Reaper in i3WM. So this it seems is being caused by a change in v2.52 & up because v2.35 is working well fo me in all the kernels & i3WM expect of course kernel 5.2.

Is there any change from v2.52 up that could be causing these freezes with Reaper & i3WM? Since the freezes don't seem to be caused by the kernel.. Just in case I haven't mentioned it I'm running Manjaro.

osxmidi commented 5 years ago

Most of the recent LinVst changes have been due to handling a WM_PAINT bug that some Windows vst's have ie Waves and Melda.

Not much else has changed.

Seeing that kernel 5.2 is new and the current Wine binaries seem to have some sort of memory allocation bug with kernel 5.2, then I'd suggest going back to the old kernel (if you can) and waiting for new Wine updates.

kytdkut commented 5 years ago

You can go back to the old time by deleting the -DNEWTIME entries from the Makefile (if you make LinVst)

I've experienced the host tempo bug with versions 2.55 and 2.6 on kernels 5.1.16 and 5.2.4. This was using EchoBoy in Renoise and REAPER, latest versions.

Deleting -DNEWTIME from the makefile does not fix the issue. Plugins are still not aware of host tempo.

2.6 does fix the recently introduced bug on kernel 5.2 though; in my case every plugin was loading ok, but when opening its GUI the host crashed (Renoise). This is not happening with 2.6.

I'm back to using kernel 5.16 and LinVst 2.5 for the time being, this is the last stable configuration.

osxmidi commented 5 years ago

If you change line 1504 in lin-vst-server.cpp

from

/// printf("newtime %f\n", timeInfo.sampleRate);

to

printf("newtime %f\n", timeInfo.sampleRate);

(just remove the // at the start of the line)

and then start Reaper from a terminal window and watch the terminal output as you load a plugin, the current sample rate should be printed out and that means that the plugin is getting the timeinfo from Reaper.

Ogami-Z commented 5 years ago

I've run v2.6 in kernel 5.1.21 & the timing isn't working there either so it's whatever's been changed since v2.54 that's causing it.

As for the changes that were made to handle the WM_PAINT bug, is there anything I can change to revert back to the way v2.32 worked so that I can have later versions work well with i3WM? I don't use any waves plugins, the only win plugins I really need are Kontakt (I have a lot of sample libraries) & Amplitube 4

Ogami-Z commented 5 years ago

Correction it's v2.32 not 2.35 I've been using pre kernel 5.2 without issue.

osxmidi commented 5 years ago

The WM_PAINT bug that Waves and Melda have is just for the GUI and has nothing to do with the timeinfo bpm.

The basic timeinfo code hasn't changed for the newer LinVst versions after version 2.32 and even before version 2.32.

LinVst just gets the timeinfo from Reaper and passes it onto the plugin when the plugin asks for it, so there is not much to it and not much that can be changed.

If the plugin is asking for the timeinfo, then the current samplerate will be displayed in a terminal (after starting Reaper from the same terminal)

If you change line 1504 in lin-vst-server.cpp

from

// printf("newtime %f\n", timeInfo.sampleRate);

to

printf("newtime %f\n", timeInfo.sampleRate);

(just remove the // at the start of the line)is changed to tempo

if printf("newtime %f\n", timeInfo.sampleRate); is changed to printf("newtime %f\n", timeInfo.tempo);

then the tempo in bpm will be displayed in the terminal.

The samplerate and tempo (bpm) are being displayed correctly on my system using LinVst 2.6 version with a 5.2 kernel and a synth vst that asks for the timeinfo.

I'll put the LinVst 2.32 code here in case you want it

LinVst-master.zip

osxmidi commented 5 years ago

If the LinVst 2.32 (or LinVst 2.35 or LinVst 2.52 or LinVst 2.6 or whatever version) tempo (bpm) isn't working properly with the 5.2 kernel then that might be due to the 5.2 kernel for your system and/or the associated libraries on your system including the current Wine version for your system and it's libraries.

Ogami-Z commented 5 years ago

No the reason I ask about the changes made for Waves & Melda plugins is for the separate issue of plugins crashing/Freezing Reaper only while running on the i3WM/gaps DE from version 2.54, 2.55, 2.6. This does not happen when using Xfce4 as the DE. And it also doesn't happen with v2.32 while running on the i3WM/gaps DE.

As for the timing problem this seem to be only with v2.6 because it's not just happening with kernel 5.2, it's also happening with 5.1.21. kytdkut has also reported timing problems with v2.55 & 2.6.

I will try what you've suggested above when I get a chance later. I Really appreciate your responsiveness with this issue.

osxmidi commented 5 years ago

Kernel 5.2 has some memory allocation incompatibility with Wine (even the latest Wine 4.13) which is not exactly normal (it basically means that Wines memory heap gets corrupted).

LinVst 2.6 (and 2.55) have a temporary workaround for the above problem but it's just a workaround and the workaround should not be needed if the 5.2 kernel and Wine were functioning normally, which they aren't.

So then you can get domino effects such as crashing etc because of the kernel 5.2/Wine problems.

All LinVst does is to ask Reaper for the timeinfo as per any native Linux vst would do, and then sends that timeinfo to the plugin via Wine, and from what I can tell the plugin is getting the timeinfo ok on my particular system which is MX Linux when used with the 5.2 liquorix (zen) kernel.

The latest kernels can have incompatibilities and they are playing around with time routines and memory routines in the 5.x kernels, and 5.3 is going to come out as well one day and who knows what that will be like.

On MX Linux the standard up to date kernel is 4.15.0-1.

So if I install later kernels than that then I might get incompatibility problems but that's to be expected as the newer kernels are sort of experimental in some ways and 5.2 broke Wine and maybe 5.1 has some timing problems with certain things.

The Waves/Melda changes are nothing much and they just apply to Waves and Melda where Waves/Melda have a WM_PAINT programming bug that results in a continuous stream of WM_PAINT messages when there should only be occasional WM_PAINT messages and the continuous WM_PAINT messages lock up the Windows message loop, but it only applies to Waves/Melda.

The funny thing is that on real Windows the bug is handled ok, even though it's a bug.

Ogami-Z commented 5 years ago

All understood & hopefully this will be sorted soon with wine & kernel 5.2. & I'm willing to wait & use another kernel until that happens.

But the freezing/crashing I'm referring to happens with Reaper only in the i3WM DE with linvst v2.54 regardless of the kernel it's running on. So whatever change was made in version 2.52 & beyond is whats causing this freezing because it doesn't happen with v2.32. This doesn't happen when running Reaper on the xfce4 DE.

Do you know of any change I can make when compiling a later version of linvst so that it will work the way v2.32 does. Just so that when it that when the time comes & I have to upgrade linvst & the kernel, it will work with the i3WM DE. I've gotten so used to i3wm that I'm reluctant to go back to xfce4.

osxmidi commented 5 years ago

I've managed to get LinVst version 2.32 working with kernel 5.2, so if this doesn't work then it's definitely the kernel/system.

Here is LinVst version 2.32 with a kernel 5.2 fix.

LinVst-master.zip

Ogami-Z commented 5 years ago

I've managed to get LinVst version 2.32 working with kernel 5.2, so if this doesn't work then it's definitely the kernel/system.

Here is LinVst version 2.32 with a kernel 5.2 fix.

LinVst-master.zip

Whatever you've done it's working!! Tested with kernel 5.2.4 on Manjaro & the timing is back to normal. & now there's no freezing with Reaper & the i3WM like there was with later versions. Also tested on Xfce4 with a project running multiple Kontakt instances & other win plugins & all seems to be great.

Thanks for the taking the time to get this working, it's very much appreciated.

osxmidi commented 5 years ago

I've also changed the current code (LinVst 2.6) to have the same fix.

osxmidi commented 5 years ago

LinVst 2.6 should be ok now (a few problems were sorted out).

Ogami-Z commented 5 years ago

I'll check 2.6 out when I get a chance tomorrow. But fo now I'm just happy to have v2.32 playing nice with i3WM & kernel 5.2.

Thanks again!

kytdkut commented 5 years ago

The tempo bug is not present anymore. REAPER needed a "Clean cache/re-scan", I don't know why.

Tested on linux 5.2 and wine-staging 4.12 and 4.13, Renoise, Reaper, EchoBoy and Diffuse.

Much appreciated!