View Issue Details

IDProjectCategoryView StatusLast Update
0002480ardourbugspublic2020-04-19 20:13
Reportercth103 Assigned Topaul  
PrioritylowSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Product VersionSVN/2.0-ongoing 
Summary0002480: segfault on trying to load a session
DescriptionI didn't realise that you can't load a session from the command line unless jack is already running. I was trying to do this, and I saw some segfaults, which the attached patch fixes. With this patch, things fail more elegantly. I've attached a backtrace for one of the segfaults, the others are very similar.
TagsNo tags attached.

Activities

2008-11-29 18:38

 

init-segfault-backtrace.txt (3,008 bytes)   
#0  0xb6c5029b in ~XMLTree (this=0xb8) at libs/pbd/xml++.cc:37
#1  0xb7f61a38 in ARDOUR::Session::destroy (this=0xa57c928) at libs/ardour/session.cc:460
#2  0xb7fcba46 in ARDOUR::Session::first_stage_init (this=0xa57c928, fullpath=
        {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0xbfaa709c "\224�m�l�\001\n\220\020\n��q��&qB\b�\003\212\bPf?\b�q����@\b(�W\np37\n�q��\234q��\230q��\001"}}, snapshot_name=
        {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0xbfaa70a0 "l�\001\n\220\020\n��q��&qB\b�\003\212\bPf?\b�q����@\b(�W\np37\n�q��\234q��\230q��\001"}})
    at libs/ardour/session_state.cc:103
#3  0xb7f6e070 in Session (this=0xa57c928, eng=@0xa373370, fullpath=@0xbfaa71a0, snapshot_name=@0xbfaa719c, mix_template=
        {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0xbfaa7198 "\224�m�l�\001\n\224�m�\f+W\n�q��\224�m�����"}}) at libs/ardour/session.cc:302
#4  0x0840c1bf in ARDOUR_UI::load_session (this=0x9e1e260, path=@0xbfaa7254, snap_name=@0xbfaa7258, mix_template=
          {static npos = 4294967295, string_ = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0xbfaa7210 "\224�m�4�\a\n4�\a\n1�j�0$-\n��m�\224�m�\224�m�0$-\ntq��tq��"}}})
    at gtk2_ardour/ardour_ui.cc:2441
#5  0x0841ceae in ARDOUR_UI::get_session_parameters (this=0x9e1e260, backend_audio_is_running=true, should_be_new=false)
    at gtk2_ardour/ardour_ui.cc:2372
#6  0x0841d1a5 in ARDOUR_UI::startup (this=0x9e1e260) at gtk2_ardour/ardour_ui.cc:650
#7  0x0842710d in sigc::bound_mem_functor0<void, ARDOUR_UI>::operator() (this=0xa0b818c) at libs/sigc++2/sigc++/functors/mem_fun.h:1787
#8  0x08427124 in sigc::adaptor_functor<sigc::bound_mem_functor0<void, ARDOUR_UI> >::operator() (this=0xa0b8188)
    at libs/sigc++2/sigc++/adaptors/adaptor_trait.h:251
#9  0x08427140 in sigc::internal::slot_call0<sigc::bound_mem_functor0<void, ARDOUR_UI>, void>::call_it (rep=0xa0b8170)
    at libs/sigc++2/sigc++/functors/slot.h:103
#10 0x08429f70 in sigc::internal::signal_emit0<void, sigc::nil>::emit (impl=0xa045240) at libs/sigc++2/sigc++/signal.h:772
#11 0x0842a038 in sigc::signal0<void, sigc::nil>::emit (this=0x9e1e2a8) at libs/sigc++2/sigc++/signal.h:2667
#12 0x0842a04b in sigc::signal0<void, sigc::nil>::operator() (this=0x9e1e2a8) at libs/sigc++2/sigc++/signal.h:2675
#13 0xb6e31015 in Gtkmm2ext::UI::run (this=0x9e1e260, old_receiver=@0x89e67ac) at libs/gtkmm2ext/gtk_ui.cc:224
#14 0x087013c2 in main (argc=2, argv=0xbfaa74c4) at gtk2_ardour/main.cc:335
(gdb) quit

init-segfault-backtrace.txt (3,008 bytes)   

2008-11-29 18:40

 

startup-segfaults.patch (3,024 bytes)   
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 8524aef..eac27fc 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -276,16 +276,23 @@ Session::Session (AudioEngine &eng,
 		  string mix_template)
 
 	: _engine (eng),
+	  mmc (0),
 	  _mmc_port (default_mmc_port),
 	  _mtc_port (default_mtc_port),
 	  _midi_port (default_midi_port),
 	  pending_events (2048),
+	  state_tree (0),
+	  butler_mixdown_buffer (0),
+	  butler_gain_buffer (0),
+	  midi_thread (pthread_t (0)),
 	  midi_requests (128), // the size of this should match the midi request pool size
 	  diskstreams (new DiskstreamList),
 	  routes (new RouteList),
 	  auditioner ((Auditioner*) 0),
 	  _total_free_4k_blocks (0),
 	  _click_io ((IO*) 0),
+	  click_data (0),
+	  click_emphasis_data (0),
 	  main_outs (0)
 {
 	bool new_session;
@@ -455,19 +462,16 @@ Session::destroy ()
 	_history.clear ();
 
 	/* clear state tree so that no references to objects are held any more */
-	
-	if (state_tree) {
-		delete state_tree;
-	}
+	delete state_tree;
 
 	terminate_butler_thread ();
 	terminate_midi_thread ();
 	
-	if (click_data && click_data != default_click) {
+	if (click_data != default_click) {
 		delete [] click_data;
 	}
 
-	if (click_emphasis_data && click_emphasis_data != default_click_emphasis) {
+	if (click_emphasis_data != default_click_emphasis) {
 		delete [] click_emphasis_data;
 	}
 
@@ -635,19 +639,12 @@ Session::destroy ()
 		i = tmp;
 	}
 
-	if (butler_mixdown_buffer) {
-		delete [] butler_mixdown_buffer;
-	}
-
-	if (butler_gain_buffer) {
-		delete [] butler_gain_buffer;
-	}
+	delete [] butler_mixdown_buffer;
+	delete [] butler_gain_buffer;
 
 	Crossfade::set_buffer_size (0);
 
-	if (mmc) {
-		delete mmc;
-	}
+	delete mmc;
 }
 
 void
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 2b7aca6..c769e57 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -155,7 +155,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
 	pending_locate_roll = false;
 	pending_locate_flush = false;
 	dstream_buffer_size = 0;
-	state_tree = 0;
 	state_was_pending = false;
 	set_next_event ();
 	outbound_mtc_smpte_frame = 0;
@@ -171,9 +170,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
 
 	_slave = 0;
 	_silent = false;
-	butler_mixdown_buffer = 0;
-	butler_gain_buffer = 0;
-	mmc = 0;
 	session_send_mmc = false;
 	session_send_mtc = false;
 	post_transport_work = PostTransportWork (0);
@@ -194,7 +190,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
 	first_file_data_format_reset = true;
 	first_file_header_format_reset = true;
 	butler_thread = (pthread_t) 0;
-	midi_thread = (pthread_t) 0;
 
 	AudioDiskstream::allocate_working_buffers();
 	
@@ -211,8 +206,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
 	   waveforms for clicks.
 	*/
 	
-	click_data = 0;
-	click_emphasis_data = 0;
 	click_length = 0;
 	click_emphasis_length = 0;
 	_clicking = false;
startup-segfaults.patch (3,024 bytes)   

paul

2008-11-30 13:40

administrator   ~0005399

carl, wow. this is embarrassing!

however, one part of this that seems wrong is removing the conditional delete of the state tree.

also, yes, you can load a session from the commandline without JACK. what makes you think otherwise?

2008-12-01 23:00

 

startup-segfaults.2.patch (1,145 bytes)   
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 77d0b02..db4b3bc 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -367,7 +367,8 @@ Editor::Editor ()
 
 	range_marker_drag_rect = 0;
 	marker_drag_line = 0;
-	
+
+	_edit_point = EditAtMouse;
 	set_mouse_mode (MouseObject, true);
 
 	frames_per_unit = 2048; /* too early to use reset_zoom () */
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index eac27fc..6754a51 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -347,14 +347,23 @@ Session::Session (AudioEngine &eng,
 		  nframes_t initial_length)
 
 	: _engine (eng),
+	  mmc (0),
 	  _mmc_port (default_mmc_port),
 	  _mtc_port (default_mtc_port),
 	  _midi_port (default_midi_port),
 	  pending_events (2048),
+	  state_tree (0),
+	  butler_mixdown_buffer (0),
+	  butler_gain_buffer (0),
+	  midi_thread (pthread_t (0)),
 	  midi_requests (16),
 	  diskstreams (new DiskstreamList),
 	  routes (new RouteList),
+	  auditioner ((Auditioner *) 0),
 	  _total_free_4k_blocks (0),
+	  _click_io ((IO *) 0),
+	  click_data (0),
+	  click_emphasis_data (0),
 	  main_outs (0)
 
 {
startup-segfaults.2.patch (1,145 bytes)   

cth103

2008-12-01 23:00

administrator   ~0005414

nearly as embarrassing as the fact that you need to apply the .2 patch I have just attached as well as the first one, as I missed a constructor :\

paul

2008-12-02 06:49

administrator   ~0005418

applied & committed, rev 4278

system

2020-04-19 20:13

developer   ~0021834

Issue has been closed automatically, by Trigger Close Plugin.
Feel free to re-open with additional information if you think the issue is not resolved.

Issue History

Date Modified Username Field Change
2008-11-29 18:38 cth103 New Issue
2008-11-29 18:38 cth103 File Added: init-segfault-backtrace.txt
2008-11-29 18:38 cth103 cost => 0.00
2008-11-29 18:40 cth103 File Added: startup-segfaults.patch
2008-11-30 13:40 paul Note Added: 0005399
2008-12-01 23:00 cth103 File Added: startup-segfaults.2.patch
2008-12-01 23:00 cth103 Note Added: 0005414
2008-12-02 06:49 paul Status new => resolved
2008-12-02 06:49 paul Resolution open => fixed
2008-12-02 06:49 paul Assigned To => paul
2008-12-02 06:49 paul Note Added: 0005418
2010-04-24 10:28 cth103 Category bugs => bugs2
2010-04-24 10:32 cth103 Category bugs2 => bugs
2020-04-19 20:13 system Note Added: 0021834
2020-04-19 20:13 system Status resolved => closed