drobilla / ingen

A realtime modular synthesizer and/or effects processor
GNU Affero General Public License v3.0
30 stars 7 forks source link

Crash when deleting sub graph inputs / outputs #32

Open loki42 opened 2 years ago

loki42 commented 2 years ago

Using the ingen -ed normal desktop build on x86 (AMD64) segfault if you delete an input or output of a sub graph. Doesn't always happen though.

Example file attached.

main.txt

_:b159 a patch:Delete ; patch:sequenceNumber "83"^^xsd:int ; patch:subject </main/main/loop_common_in_1> .

_:b160 a patch:Delete ; patch:sequenceNumber "84"^^xsd:int ; patch:subject </main/main/loop_common_out_1> .

Segmentation fault (core dumped)

drobilla commented 2 years ago

I managed to repro what was maybe this.......... when I wasn't in the debugger. Classic.

Still have that core file? Backtrace?

loki42 commented 2 years ago

I'll try and generate one again... Ubuntu cunningly doesn't generate cores when you've told ulimit to generate them... I now need to look at the "app reporter".... arg.

drobilla commented 2 years ago

I'll probably catch it eventually, but figured I'd ask.

loki42 commented 2 years ago

I'll need to recompile with debugging, but I've worked out how the Ubuntu core dump thingy works:

Program terminated with signal SIGSEGV, Segmentation fault.

0 0x00007ff0ab191d08 in std::__uniq_ptr_impl<ingen::server::PortImpl::Voice, std::default_delete<ingen::server::PortImpl::Voice []> >::_M_ptr() const () from /usr/lib/libingen_server.so

[Current thread is 1 (Thread 0x7ff0a84b6700 (LWP 11879))] (gdb) bt

0 0x00007ff0ab191d08 in std::__uniq_ptr_impl<ingen::server::PortImpl::Voice, std::default_delete<ingen::server::PortImpl::Voice []> >::_M_ptr() const () from /usr/lib/libingen_server.so

1 0x00007ff0ab191bca in std::unique_ptr<ingen::server::PortImpl::Voice [], std::default_delete<ingen::server::PortImpl::Voice []> >::get() const () from /usr/lib/libingen_server.so

2 0x00007ff0ab191a94 in std::unique_ptr<ingen::server::PortImpl::Voice [], std::default_delete<ingen::server::PortImpl::Voice []> >::operator[](unsigned long) const () from /usr/lib/libingen_server.so

3 0x00007ff0ab19196b in raul::Array::at(unsigned long) const () from /usr/lib/libingen_server.so

4 0x00007ff0ab1916da in ingen::server::PortImpl::buffer(unsigned int) const () from /usr/lib/libingen_server.so

5 0x00007ff0ab19101d in ingen::server::ArcImpl::buffer(ingen::server::RunContext const&, unsigned int) const ()

from /usr/lib/libingen_server.so

6 0x00007ff0ab1ed16a in ingen::server::InputPort::pre_run(ingen::server::RunContext&) () from /usr/lib/libingen_server.so

7 0x00007ff0ab1c969d in ingen::server::DuplexPort::post_process(ingen::server::RunContext&) () from /usr/lib/libingen_server.so

8 0x00007ff0ab1a6625 in ingen::server::BlockImpl::post_process(ingen::server::RunContext&) () from /usr/lib/libingen_server.so

9 0x00007ff0ab1e3215 in ingen::server::GraphImpl::process(ingen::server::RunContext&) () from /usr/lib/libingen_server.so

10 0x00007ff0ab1cddea in ingen::server::Engine::run(unsigned int) () from /usr/lib/libingen_server.so

11 0x00007ff0a864d083 in ingen::server::JackDriver::_process_cb(unsigned int) () from /usr/lib/libingen_jack.so

12 0x00007ff0a864e6f5 in ingen::server::JackDriver::process_cb(unsigned int, void*) () from /usr/lib/libingen_jack.so

13 0x00007ff0a85d7ac2 in ?? () from /lib/x86_64-linux-gnu/libjack.so.0

14 0x00007ff0a85d7228 in ?? () from /lib/x86_64-linux-gnu/libjack.so.0

15 0x00007ff0a85f0280 in ?? () from /lib/x86_64-linux-gnu/libjack.so.0

16 0x00007ff0ab413609 in start_thread (arg=) at pthread_create.c:477

17 0x00007ff0ab588133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

drobilla commented 2 years ago

Nice, thanks.

... yaaay destruction crashes. Those are always "fun".

drobilla commented 2 years ago

Er, no, I got confused by the type. Probably a race.

loki42 commented 2 years ago

Give me a yell if you're having trouble reproducing it and I can upload a trace from a debug build. It doesn't happen every time so I'm assuming race.

On Fri, 23 Sept 2022 at 04:33, David Robillard @.***> wrote:

Er, no, I got confused by the type. Probably a race.

— Reply to this email directly, view it on GitHub https://github.com/drobilla/ingen/issues/32#issuecomment-1255403013, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAISQBD46OSQLJLUUPWYPDDV7SRBHANCNFSM6AAAAAAQQXZUFI . You are receiving this because you authored the thread.Message ID: @.***>

drobilla commented 2 years ago

Won't hurt, but I've ended up on a tangent struggle with sanitizers not working on my machine for some reason. I suspect tsan will show something here a lot more easily than trying to figure it out manually...

Heading away for the weekend though, so I'll have to pick this one up again on Monday.

loki42 commented 1 year ago

I care more about bypass from midi but if you're in a bug fixing mood give me a yell if you need help reproducing this deletion bug or if it's fixed and we can close it.

On Sun, 25 Sept 2022, 1:09 am David Robillard, @.***> wrote:

Won't hurt, but I've ended up on a tangent struggle with sanitizers not working on my machine for some reason. I suspect tsan will show something here a lot more easily than trying to figure it out manually...

Heading away for the weekend though, so I'll have to pick this one up again on Monday.

— Reply to this email directly, view it on GitHub https://github.com/drobilla/ingen/issues/32#issuecomment-1256991009, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAISQBBHEBMYZPDK7UMHEP3V74KS7ANCNFSM6AAAAAAQQXZUFI . You are receiving this because you authored the thread.Message ID: @.***>

drobilla commented 1 year ago

I've managed to kind of reproduce it sometimes maybe, but life got in the way. I think it has something to do with the locking not going "high enough", to protect changes to the parent graph as well (this is the only case where changing something in a graph mucks with the process order and so on of the parent). A reliable repro would certainly be nice, but I'm not super blocked on it.

Hopefully will have more free time in the fall to figure this one out...