falkTX / dssi-vst

DSSI plugin wrapper for VST plugins
Other
109 stars 26 forks source link

Fix broken shared 32-/64-bit semaphores on recent glibc versions. #13

Closed kramlie closed 6 years ago

kramlie commented 6 years ago

Recent versions of glibc have changed the memory layout of semaphores on 64-bit, which means that 32- and 64-bit semaphores are fundamentally incompatible and cannot be shared anymore. The symptom is that the plugin hangs on communicating with the child process, and eventually times out.

However, my previous assumption in 2cefab1f9f22, that pipes are not realtime safe on Linux, was incorrect. They are used by Jack all the time. So the problem is fixed by switching to pipes for process synchronization. Shared memory is still used for the data though, as well as to store the pipe descriptors.

Another nice side effect of this fix is that we now get notified again when the child process dies or otherwise breaks the connection.

Signed-off-by: Kristian Amlie kristian@amlie.name

falkTX commented 6 years ago

Where did you read that pipes are realtime safe? it's a read and write call..

Jack2 does not use pipes for the sync of audio threads, it used to have a similar design to dssi-vst (with semaphores) and now it uses linux futexes directly (that part was added by me)

in any case, since current dssi-vst does not work anymore, I will just accept the PR assuming it works correctly.

kramlie commented 6 years ago

Actually, I didn't read it, I just saw that Jack1 uses them internally, and has been for a long time. I don't think there is a formal guarantee. I guess as long as the content is small, and you're not blowing any buffer sizes, then essentially it boils down to a mutex or two in the kernel anyway. This is just one byte at a time, so should be pretty safe.

Thanks for merging!

On March 30, 2018 9:04:57 PM GMT+02:00, Filipe Coelho notifications@github.com wrote:

Where did you read that pipes are realtime safe? it's a read and write call..

Jack2 does not use pipes for the sync of audio threads, it used to have a similar design to dssi-vst (with semaphores) and now it uses linux futexes directly (that part was added by me)

in any case, since current dssi-vst does not work anymore, I will just accept the PR assuming it works correctly.

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/falkTX/dssi-vst/pull/13#issuecomment-377598296

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

falkTX commented 6 years ago

Jack1 uses pipes for some event mechanism, but not for audio process syncing. read and write calls are never realtime-safe afaik, but so is not wine anyway.