View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001464 | ardour | bugs | public | 2007-02-04 14:38 | 2008-11-20 23:57 |
| Reporter | naptastic | Assigned To | paul | ||
| Priority | low | Severity | crash | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Summary | 0001464: Segmentation fault when opening a session from the recent sessions list when the session file does not exist. | ||||
| Description | Create a session, do something with it, blah blah, then exit Ardour. Delete the session. (I deleted the entire directory; haven't tested if that's necessary.) Invoke ardour2. The session will appear in the recent list without the little triangle next to it. If you try to open it, it will say that you don't have write access to the session, which prevents the session from being opened. (which isn't perfectly accurate.) The editor window opens, with much functionality disabled. From this window, you can't "file -> close" in order to get back to the opening dialog; the only way to get there is to "file -> quit" and then reinvoke ardour2. | ||||
| Tags | No tags attached. | ||||
|
|
Oops--what I said above wasn't completely accurate. I thought I had deleted the whole dir and I hadn't. The session files were deleted but the directory was still there and the permissions were set wrong. Now when I try to open it, Ardour correctly reports that the session files are missing... and then segfaults. |
|
|
I can reproduce this although it took a bit little while figure out how to do so. I don't believe it has anything to do with permissions on the folder or files as I can reproduce it simply by: 1. Removing all the files from the session folder(but not removing the session folder itself) 2. Starting ardour(in this case svn rev 1424) and navigating to Open Session tab in the session control dialog that displays the recent sessions. 3. Selecting the name of the session that I just removed the session files from(which is displayed without the triangular expander arrow as pointed out by naptastic) and clicking on the open button. I get a consistant backtrace which I'll attach. |
|
2007-02-06 01:43
|
segfault-loading-session.txt (6,319 bytes)
(gdb) run
Starting program: /home/timbyr/devel/ardour/svn/trunk/gtk2_ardour/ardour-2.0beta11.1
[Thread debugging using libthread_db enabled]
[New Thread 46912543439568 (LWP 13542)]
Ardour/GTK 2.0beta11.1
(built using 1345 and GCC version 4.1.1 20070105 (Red Hat 4.1.1-51))
Copyright (C) 1999-2006 Paul Davis
Some portions Copyright (C) Steve Harris, Ari Johnson, Brett Viren, Joel Baker
Ardour comes with ABSOLUTELY NO WARRANTY
not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This is free software, and you are welcome to redistribute it
under certain conditions; see the source for copying conditions.
Loading ui configuration file gtk2_ardour/ardour2_ui.rc
theme_init() called from internal clearlooks engine
/usr/share/themes/Clearlooks/gtk-2.0/gtkrc:59: error: unexpected identifier `animation', expected character `}'
theme_init() called from internal clearlooks engine
loading user configuration file /home/timbyr/.ardour2/ardour.rc
ardour: [WARNING]: no MIDI ports specified: no MMC or MTC control possible
ardour: [INFO]: Using SSE optimized routines
ardour: [INFO]: looking for control protocols in /home/timbyr/.ardour2/surfaces/:/usr/local/lib64/ardour2/surfaces/
[New Thread 1074240096 (LWP 13546)]
[New Thread 1084733760 (LWP 13548)]
[New Thread 1095223616 (LWP 13549)]
[New Thread 1105713472 (LWP 13550)]
[New Thread 1116203328 (LWP 13551)]
[New Thread 1126693184 (LWP 13552)]
[New Thread 1137183040 (LWP 13553)]
[New Thread 1147672896 (LWP 13554)]
[New Thread 1158162752 (LWP 13555)]
[New Thread 1168652608 (LWP 13557)]
[New Thread 1179142464 (LWP 13558)]
ardour: [WARNING]: Your system generates "Mod2" when the NumLock key is pressed. This can cause problems when editing so Ardour will use Mod3 to mean Meta rather than Mod2
loading bindings from gtk2_ardour/ardour.bindings
[New Thread 1179642464 (LWP 13560)]
[Thread 1095223616 (LWP 13549) exited]
[Thread 1179142464 (LWP 13558) exited]
[Thread 1084733760 (LWP 13548) exited]
[Thread 1105713472 (LWP 13550) exited]
[Thread 1116203328 (LWP 13551) exited]
[Thread 1126693184 (LWP 13552) exited]
[Thread 1137183040 (LWP 13553) exited]
[Thread 1147672896 (LWP 13554) exited]
[Thread 1158162752 (LWP 13555) exited]
[Thread 1168652608 (LWP 13557) exited]
[New Thread 1180174656 (LWP 13561)]
[New Thread 1084733760 (LWP 13562)]
[New Thread 1147672896 (LWP 13563)]
[New Thread 1126693184 (LWP 13564)]
[New Thread 1095223616 (LWP 13565)]
[New Thread 1105713472 (LWP 13566)]
[New Thread 1116203328 (LWP 13567)]
[New Thread 1137183040 (LWP 13568)]
[New Thread 1158162752 (LWP 13569)]
[Thread 1084733760 (LWP 13562) exited]
[Thread 1147672896 (LWP 13563) exited]
[Thread 1158162752 (LWP 13569) exited]
[Thread 1095223616 (LWP 13565) exited]
[Thread 1105713472 (LWP 13566) exited]
[Thread 1126693184 (LWP 13564) exited]
[Thread 1137183040 (LWP 13568) exited]
[Thread 1116203328 (LWP 13567) exited]
Loading session /home/timbyr/sessions/naptastic using snapshot naptastic (1)
ardour: [ERROR]: naptastic: session state information file "/home/timbyr/sessions/naptastic/naptastic.ardour" doesn't exist!
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46912543439568 (LWP 13542)]
0x00000032bc607488 in pthread_join () from /lib64/libpthread.so.0
(gdb) t a a bt
Thread 14 (Thread 1180174656 (LWP 13561)):
#0 0x00000032bbac4a36 in poll () from /lib64/libc.so.6
#1 0x00000032c5007606 in jack_client_close () from /usr/lib64/libjack.so.0
#2 0x00000032bc606305 in start_thread () from /lib64/libpthread.so.0
#3 0x00000032bbacd50d in clone () from /lib64/libc.so.6
#4 0x0000000000000000 in ?? ()
Thread 13 (Thread 1179642464 (LWP 13560)):
#0 0x00000032bbac4a36 in poll () from /lib64/libc.so.6
#1 0x00002aaaaacc77d9 in ARDOUR::AudioSource::peak_thread_work (arg=0x0) at libs/ardour/audiosource.cc:140
#2 0x00000032bc606305 in start_thread () from /lib64/libpthread.so.0
#3 0x00000032bbacd50d in clone () from /lib64/libc.so.6
#4 0x0000000000000000 in ?? ()
Thread 2 (Thread 1074240096 (LWP 13546)):
#0 0x00000032bc60d4a1 in nanosleep () from /lib64/libpthread.so.0
#1 0x0000003c7464b2b8 in g_usleep () from /lib64/libglib-2.0.so.0
#2 0x00002aaaac6695c1 in Glib::usleep (microseconds=10000) at libs/glibmm2/glibmm/timer.cc:68
#3 0x00002aaaaacaa1b4 in ARDOUR::AudioEngine::meter_thread (this=0x122ab30) at libs/ardour/audioengine.cc:413
#4 0x00002aaaaacad20b in sigc::bound_mem_functor0<void, ARDOUR::AudioEngine>::operator() (this=0x112ebb8) at libs/sigc++2/sigc++/functors/mem_fun.h:1781
#5 0x00002aaaaacad227 in sigc::adaptor_functor<sigc::bound_mem_functor0<void, ARDOUR::AudioEngine> >::operator() (this=0x112ebb0)
at libs/sigc++2/sigc++/adaptors/adaptor_trait.h:251
#6 0x00002aaaaacad24b in sigc::internal::slot_call0<sigc::bound_mem_functor0<void, ARDOUR::AudioEngine>, void>::call_it (rep=0x112eb80)
at libs/sigc++2/sigc++/functors/slot.h:103
#7 0x000000000074cf07 in sigc::slot0<void>::operator() (this=0x11239b0) at libs/sigc++2/sigc++/functors/slot.h:440
#8 0x00002aaaac65f540 in call_thread_entry_slot (data=0x11239b0) at libs/glibmm2/glibmm/thread.cc:43
#9 0x0000003c746490f4 in g_thread_create_full () from /lib64/libglib-2.0.so.0
#10 0x00000032bc606305 in start_thread () from /lib64/libpthread.so.0
#11 0x00000032bbacd50d in clone () from /lib64/libc.so.6
#12 0x0000000000000000 in ?? ()
Thread 1 (Thread 46912543439568 (LWP 13542)):
#0 0x00000032bc607488 in pthread_join () from /lib64/libpthread.so.0
#1 0x00002aaaaadcf2f4 in ARDOUR::Session::terminate_butler_thread (this=0x16fc800) at libs/ardour/session_butler.cc:110
#2 0x00002aaaaada1dd6 in ARDOUR::Session::destroy (this=0x16fc800) at libs/ardour/session.cc:438
#3 0x00002aaaaada99d7 in Session (this=0x16fc800, eng=@0x122ab30, fullpath=@0x7fff36dccc70, snapshot_name=@0x7fff36dccc80, mix_template=0x0)
at libs/ardour/session.cc:290
#4 0x00000000007588a2 in ARDOUR_UI::load_session (this=0xebf190, path=@0x7fff36dccda0, snap_name=@0x7fff36dccdb0, mix_template=0x0)
at gtk2_ardour/ardour_ui.cc:1892
#5 0x00000000007590ea in ARDOUR_UI::new_session (this=0xebf190, predetermined_path=@0x7fff36dccf50) at gtk2_ardour/ardour_ui.cc:1738
#6 0x00000000009b2306 in maybe_load_session () at gtk2_ardour/main.cc:303
#7 0x00000000009b33b6 in main (argc=1, argv=0x7fff36dcd208) at gtk2_ardour/main.cc:459
(gdb)
|
|
|
Changing the summary to better reflect the nature of the bug. |
|
|
This seems to be because if load_state () in Session::second_stage_init () fails, start_butler_thread () will never be called and yet terminate_butler_thread () IS called in Session::destroy (). Hence when terminate_butler_thread () is called it passes a garbage handle to pthread_join (). Similar problems exist with the midi thread. I attach a patch which fixes the segfault; not sure if it's done in a way that the devs would approve of! |
|
2007-02-20 17:23
|
recent-files-segfault-patch1 (3,073 bytes)
Index: libs/ardour/ardour/session.h
===================================================================
--- libs/ardour/ardour/session.h (revision 1479)
+++ libs/ardour/ardour/session.h (working copy)
@@ -1118,6 +1118,7 @@
Sample* butler_mixdown_buffer;
float* butler_gain_buffer;
pthread_t butler_thread;
+ bool butler_thread_started;
Glib::Mutex butler_request_lock;
Glib::Cond butler_paused;
bool butler_should_run;
@@ -1370,6 +1371,7 @@
Glib::Mutex midi_lock;
pthread_t midi_thread;
+ bool midi_thread_started;
int midi_request_pipe[2];
mutable gint butler_active;
RingBuffer<MIDIRequest*> midi_requests;
Index: libs/ardour/session_midi.cc
===================================================================
--- libs/ardour/session_midi.cc (revision 1479)
+++ libs/ardour/session_midi.cc (working copy)
@@ -1091,6 +1091,8 @@
return -1;
}
+ midi_thread_started = true;
+
// pthread_detach (midi_thread);
return 0;
@@ -1099,6 +1101,10 @@
void
Session::terminate_midi_thread ()
{
+ if (midi_thread_started == false) {
+ return;
+ }
+
MIDIRequest* request = new MIDIRequest;
void* status;
@@ -1108,6 +1114,7 @@
poke_midi_thread ();
pthread_join (midi_thread, &status);
+ midi_thread_started = false;
}
void
Index: libs/ardour/session_butler.cc
===================================================================
--- libs/ardour/session_butler.cc (revision 1479)
+++ libs/ardour/session_butler.cc (working copy)
@@ -98,16 +98,24 @@
// pthread_detach (butler_thread);
+ butler_thread_started = true;
+
return 0;
}
void
Session::terminate_butler_thread ()
{
+ if (butler_thread_started == false) {
+ return;
+ }
+
void* status;
char c = ButlerRequest::Quit;
::write (butler_request_pipe[1], &c, 1);
pthread_join (butler_thread, &status);
+
+ butler_thread_started = false;
}
void
Index: libs/ardour/session.cc
===================================================================
--- libs/ardour/session.cc (revision 1479)
+++ libs/ardour/session.cc (working copy)
@@ -262,6 +262,8 @@
_mtc_port (default_mtc_port),
_midi_port (default_midi_port),
pending_events (2048),
+ butler_thread_started(false),
+ midi_thread_started(false),
midi_requests (128), // the size of this should match the midi request pool size
diskstreams (new DiskstreamList),
routes (new RouteList),
@@ -281,7 +283,6 @@
new_session = !g_file_test (_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR));
if (new_session) {
if (create (new_session, mix_template, compute_initial_length())) {
- cerr << "create failed\n";
destroy ();
throw failed_constructor ();
}
@@ -321,6 +322,8 @@
_mtc_port (default_mtc_port),
_midi_port (default_midi_port),
pending_events (2048),
+ butler_thread_started(false),
+ midi_thread_started(false),
midi_requests (16),
diskstreams (new DiskstreamList),
routes (new RouteList),
|
|
|
fixed as part of the corrections for another bug. thread ID's are initialized now, and we check before calling pthread_join() when shutting down the session. technically, doing this in a 100% thread-safe way is pretty complex, but for all likely situations, this works just fine. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2007-02-04 14:38 | naptastic | New Issue | |
| 2007-02-04 14:43 | naptastic | Note Added: 0003166 | |
| 2007-02-06 01:42 | timbyr | Note Added: 0003181 | |
| 2007-02-06 01:43 | timbyr | File Added: segfault-loading-session.txt | |
| 2007-02-06 01:43 | timbyr | Status | new => acknowledged |
| 2007-02-06 01:45 | timbyr | Priority | normal => low |
| 2007-02-06 01:45 | timbyr | Severity | minor => crash |
| 2007-02-06 06:48 | timbyr | Note Added: 0003182 | |
| 2007-02-06 06:48 | timbyr | Summary | Poor behavior when trying to open a deleted session from the recent sessions list => Segmentation fault when opening a session from the recent sessions list when the session file does not exist. |
| 2007-02-10 10:33 | timbyr | Relationship added | related to 0001483 |
| 2007-02-20 17:23 | cth103 | Note Added: 0003332 | |
| 2007-02-20 17:23 | cth103 | File Added: recent-files-segfault-patch1 | |
| 2007-02-20 17:27 | cth103 | Note Edited: 0003332 | |
| 2007-02-26 14:16 | paul | Status | acknowledged => resolved |
| 2007-02-26 14:16 | paul | Resolution | open => fixed |
| 2007-02-26 14:16 | paul | Assigned To | => paul |
| 2007-02-26 14:16 | paul | Note Added: 0003398 | |
| 2007-03-19 00:17 | timbyr | Relationship deleted | related to 0001483 |
| 2008-11-20 23:57 | seablade | Status | resolved => closed |