nih-plug
nih-plug copied to clipboard
execute_background internal assert - vst3 view.rs on_fd_is_set read assert does not check EAGAIN and EWOULDBLOCK
I am using the task executor and execute_background queue.
I am getting the following error and my Bitwig VST3 plugin crashes:
[ERROR] thread 'unnamed' panicked at 'assertion `left == right` failed
left: -1
right: 1': /home/weicon/devel/rust/nih-plug/src/wrapper/vst3/view.rs:492
0: <unknown>
1: <unknown>
2: <unknown>
3: <unknown>
4: <unknown>
5: <unknown>
6: <unknown>
7: <unknown>
8: <unknown>
9: <unknown>
10: <unknown>
11: <unknown>
12: <unknown>
13: __libc_start_call_main
at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
14: __libc_start_main_impl
at ./csu/../csu/libc-start.c:392:3
15: _start
The problem is, that libc::read can of course always return -1, even if the FD was woken up by the event loop. It's important to check if the errno == EAGAIN || errno == EWOULDBLOCK, because in those cases the error is okay and just means to try to read again.