From 633f2189111be18cb03fe847707b0f598e453abe Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 28 Apr 2016 21:15:26 +0200 Subject: fix a deadlock with jack2 when inserting a plugin adds ports. When adding a processor, the processor may add ports leading to a call to jack_port_register(). while Ardour holds a WritertLock on the processor-list (this commit removes this WriterLock). with jack2 that results in a graph-reorder callback (WHY?) jack2 issues that graph-reorder in a separate thread BUT port-registration does not return until the graph-reorder is complete. On Ardour's side, graph_reordered() calls Session::resort_routes () which eventually checks Route::direct_feeds_according_to_reality() which needs a ReadLock on the processor-list to check I/O. Since jack_port_register() does not return, this constitutes a deadlock. THE ACTUAL PROBLEM IS JACK2's THREAD DESIGN! Why does jack_port_register() trigger a graph-order in jack2? No connections are made. ..and why does it block jack_port_register() from returning if that graph-order callback is in a different thread? http://pastebin.com/DZANXJLz --- libs/ardour/ardour/route.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libs/ardour/ardour/route.h') diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 66a83cf67d..bac33ae7a1 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -848,7 +848,7 @@ class LIBARDOUR_API Route : public SessionObject, public Automatable, public Rou bool _initial_io_setup; bool _in_sidechain_setup; - int configure_processors_unlocked (ProcessorStreams*); + int configure_processors_unlocked (ProcessorStreams*, Glib::Threads::RWLock::WriterLock*); bool set_meter_point_unlocked (); void apply_processor_order (const ProcessorList& new_order); -- cgit v1.2.3