Crash when manipulating MP3

I’m seeing a repeatable (though somewhat inconsistent) crash when importing and manipulating an MP3 alongside other voice tracks.

OS X 10.15.6
Audacity 2.4.2

Steps to reproduce are not always consistent, but here’s what I was doing yesterday. I repeated these steps right now afresh, and it crashes again.

  1. Import WAV into Audacity (voice recording for podcast).
  2. Import MP3 audio file.
  3. Re-arrange tracks, putting MP3 at the top. Time shift voice track to ensure MP3 starts playing first.
  4. Hit play → Audacity crashes.

At this point I re-open Audacity and recover my project. Hit play → crash. Re-open Audacity and move the playhead further into the track. Hit play and playback is fine. Return playhead to the beginning, hit play → crash.

Concerned that my project was corrupt, I also returned to an earlier version of my files, before I imported the MP3. It works fine. I import the MP3, hit play, everything is fine. Then I drop the gain on the MP3 track to -12 (what I usually do), hit play and Audacity crashes. Reload all the files, leave the gain unchanged once more, and playback is fine. Move the MP3 to the top track, hit play, Audacity crashes.

I saw the exact same kind of behaviours about 2 Audacity versions ago, and the problem just seemed to go away eventually. I’m no expert, but it seems to be some sort of memory violation that is triggered by manipulating tracks, time-shift or gain of imported MP3s. I wonder if there’s a different between sample rates on the files that could also be involved. Does that help at all?

Here’s the first portion of the crash dump I’m getting:

Process:               Audacity [11682]
Path:                  /Applications/Audacity.app/Contents/MacOS/Audacity
Identifier:            org.audacityteam.audacity
Version:               2.4.2.0 (2.4.2.0)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Audacity [11682]
User ID:               502

Date/Time:             2020-08-28 11:28:36.142 -0400
OS Version:            Mac OS X 10.15.6 (19G2021)
Report Version:        12
Anonymous UUID:        B9DC4188-10E6-6BEA-7BFB-925950057A31

Sleep/Wake UUID:       F805916B-6C99-4B1F-8484-D07673557082

Time Awake Since Boot: 63000 seconds
Time Since Wake:       1900 seconds

System Integrity Protection: enabled

Crashed Thread:        6

Exception Type:        EXC_BAD_ACCESS (SIGABRT)
Exception Codes:       KERN_INVALID_ADDRESS at 0x00007f9b00c7d000
Exception Note:        EXC_CORPSE_NOTIFY

VM Regions Near 0x7f9b00c7d000:
    MALLOC_LARGE           00007f9b00c00000-00007f9b00c7d000 [  500K] rw-/rwx SM=PRV  
--> 
    MALLOC_LARGE           00007f9b00c9a000-00007f9b00e26000 [ 1584K] rw-/rwx SM=PRV  

Application Specific Information:
*** Terminating app due to uncaught exception 'NSGenericException', reason: '-[NSApplication runModalSession:] may only be invoked from the main thread. Behavior on other threads is undefined.'
abort() called
terminating with uncaught exception of type NSException

Application Specific Backtrace 1:
0   CoreFoundation                      0x00007fff30c59b57 __exceptionPreprocess + 250
1   libobjc.A.dylib                     0x00007fff69aa05bf objc_exception_throw + 48
2   CoreFoundation                      0x00007fff30c599b5 +[NSException raise:format:] + 189
3   AppKit                              0x00007fff2e6e235d _NSRunModal + 238
4   AppKit                              0x00007fff2e2e1320 -[NSApplication runModalSession:] + 241
5   libwx_osx_cocoau_release_core-3.1.3 0x000000010368e470 _ZN14wxGUIEventLoop17DoDispatchTimeoutEm + 64
6   libwx_baseu_release-3.1.3.0.0.dylib 0x0000000103481473 _ZN13wxCFEventLoop15DispatchTimeoutEm + 35
7   libwx_baseu_release-3.1.3.0.0.dylib 0x000000010348154d _ZN13wxCFEventLoop8OSXDoRunEv + 109
8   libwx_osx_cocoau_release_core-3.1.3 0x000000010368eb0d _ZN16wxModalEventLoop8OSXDoRunEv + 189
9   libwx_baseu_release-3.1.3.0.0.dylib 0x000000010348161d _ZN13wxCFEventLoop5DoRunEv + 29
10  libwx_baseu_release-3.1.3.0.0.dylib 0x00000001033e0a15 _ZN15wxEventLoopBase3RunEv + 85
11  libwx_osx_cocoau_release_core-3.1.3 0x00000001035ede29 _ZN8wxDialog9ShowModalEv + 105
12  libwx_osx_cocoau_release_qa-3.1.3.0 0x0000000103e9ecef _ZNK23wxDebugReportPreviewStd4ShowER13wxDebugReport + 47
13  Audacity                            0x0000000101a4b9d6 _ZN11CrashReport8GenerateEN13wxDebugReport7ContextE + 1734
14  Audacity                            0x00000001019c393e _ZN11AudacityApp16OnFatalExceptionEv + 14
15  libwx_baseu_release-3.1.3.0.0.dylib 0x00000001034cdb7c _ZL20wxFatalSignalHandleri + 28
16  libsystem_platform.dylib            0x00007fff6ae415fd _sigtramp + 29
17  ???                                 0x0000000000004007 0x0 + 16391
18  Audacity                            0x0000000102377f54 soxr_process + 676
19  Audacity                            0x0000000101ba701c _ZN8Resample7ProcessEdPfmbS0_m + 140
20  Audacity                            0x0000000101b04ebe _ZN5Mixer16MixVariableRatesEPiR14WaveTrackCacheP11sampleCountPfS0_S0_P8Resample + 478
21  Audacity                            0x0000000101b036bb _ZN5Mixer7ProcessEm + 763
22  Audacity                            0x00000001019dc604 _ZN7AudioIO11FillBuffersEv + 1652
23  Audacity                            0x00000001019dbed1 _ZN11AudioThread5EntryEv + 81
24  Audacity                            0x00000001019e09e9 _ZN11AudioThread8callbackEPv + 9
25  libsystem_pthread.dylib             0x00007fff6ae4d109 _pthread_start + 148
26  libsystem_pthread.dylib             0x00007fff6ae48b8b thread_start + 15

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff6ad8c756 __semwait_signal + 10
1   libsystem_c.dylib             	0x00007fff6ad0feea nanosleep + 196
2   libsystem_c.dylib             	0x00007fff6ad0fde4 usleep + 53
3   Audacity                      	0x00000001019d71cd AudioIO::StartStream(TransportTracks const&, double, double, AudioIOStartStreamOptions const&) + 3789
4   Audacity                      	0x0000000101b4dfd7 ProjectAudioManager::PlayPlayRegion(SelectedRegion const&, AudioIOStartStreamOptions const&, PlayMode, bool, bool) + 1959
5   Audacity                      	0x0000000101b50363 ProjectAudioManager::PlayCurrentRegion(bool, bool) + 323
6   libwx_baseu_release-3.1.3.0.0.dylib	0x00000001034a0e9f wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) + 415
7   libwx_baseu_release-3.1.3.0.0.dylib	0x00000001034a1bca wxEvtHandler::ProcessEventLocally(wxEvent&) + 90
8   libwx_baseu_release-3.1.3.0.0.dylib	0x00000001034a1ac0 wxEvtHandler::ProcessEvent(wxEvent&) + 96
9   libwx_osx_cocoau_release_core-3.1.3.0.0.dylib	0x00000001037b6ee2 wxWindowBase::TryAfter(wxEvent&) + 146
10  libwx_baseu_release-3.1.3.0.0.dylib	0x00000001034a1fcc wxEvtHandler::SafelyProcessEvent(wxEvent&) + 12
11  Audacity                      	0x000000010222a156 AButton::Click() + 166
12  Audacity                      	0x0000000102227f19 AButton::OnMouseEvent(wxMouseEvent&) + 521
13  libwx_baseu_release-3.1.3.0.0.dylib	0x00000001034a0e9f wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) + 415
14  libwx_baseu_release-3.1.3.0.0.dylib	0x00000001034a1bca wxEvtHandler::ProcessEventLocally(wxEvent&) + 90
15  libwx_baseu_release-3.1.3.0.0.dylib	0x00000001034a1ac0 wxEvtHandler::ProcessEvent(wxEvent&) + 96
16  libwx_baseu_release-3.1.3.0.0.dylib	0x00000001034a1fcc wxEvtHandler::SafelyProcessEvent(wxEvent&) + 12
17  libwx_osx_cocoau_release_core-3.1.3.0.0.dylib	0x00000001036b3f49 wxWidgetCocoaImpl::DoHandleMouseEvent(NSEvent*) + 89
18  libwx_osx_cocoau_release_core-3.1.3.0.0.dylib	0x00000001036adac7 wxWidgetCocoaImpl::mouseEvent(NSEvent*, NSView*, void*) + 167
19  com.apple.AppKit              	0x00007fff2dff3e9f -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2738
20  com.apple.AppKit              	0x00007fff2dff31c9 -[NSWindow(NSEventRouting) sendEvent:] + 349
21  libwx_osx_cocoau_release_core-3.1.3.0.0.dylib	0x000000010369884b -[wxNSWindow sendEvent:] + 123
22  com.apple.AppKit              	0x00007fff2dff1554 -[NSApplication(NSEvent) sendEvent:] + 352
23  libwx_osx_cocoau_release_core-3.1.3.0.0.dylib	0x00000001035eb402 -[wxNSApplication sendEvent:] + 98
24  com.apple.AppKit              	0x00007fff2de3e5bf -[NSApplication run] + 707
25  libwx_osx_cocoau_release_core-3.1.3.0.0.dylib	0x000000010368e68a wxGUIEventLoop::OSXDoRun() + 154
26  libwx_baseu_release-3.1.3.0.0.dylib	0x000000010348161d wxCFEventLoop::DoRun() + 29
27  libwx_baseu_release-3.1.3.0.0.dylib	0x00000001033e0a15 wxEventLoopBase::Run() + 85
28  libwx_baseu_release-3.1.3.0.0.dylib	0x00000001033b8724 wxAppConsoleBase::MainLoop() + 116
29  libwx_osx_cocoau_release_core-3.1.3.0.0.dylib	0x000000010362bb2a wxApp::OnRun() + 26
30  libwx_baseu_release-3.1.3.0.0.dylib	0x0000000103410fc8 wxEntry(int&, wchar_t**) + 56
31  Audacity                      	0x00000001019c2394 main + 20
32  Audacity                      	0x000000010198dcb4 start + 52

Thread 1:: com.apple.NSEventThread
0   libsystem_kernel.dylib        	0x00007fff6ad89dfa mach_msg_trap + 10
1   libsystem_kernel.dylib        	0x00007fff6ad8a170 mach_msg + 60
2   com.apple.CoreFoundation      	0x00007fff30bddef5 __CFRunLoopServiceMachPort + 247
3   com.apple.CoreFoundation      	0x00007fff30bdc9c2 __CFRunLoopRun + 1319
4   com.apple.CoreFoundation      	0x00007fff30bdbe3e CFRunLoopRunSpecific + 462
5   com.apple.AppKit              	0x00007fff2dfef954 _NSEventThread + 132
6   libsystem_pthread.dylib       	0x00007fff6ae4d109 _pthread_start + 148
7   libsystem_pthread.dylib       	0x00007fff6ae48b8b thread_start + 15

Thread 2:: com.apple.CFSocket.private
0   libsystem_kernel.dylib        	0x00007fff6ad920fe __select + 10
1   com.apple.CoreFoundation      	0x00007fff30c06c53 __CFSocketManager + 641
2   libsystem_pthread.dylib       	0x00007fff6ae4d109 _pthread_start + 148
3   libsystem_pthread.dylib       	0x00007fff6ae48b8b thread_start + 15

Thread 3:: AMCP Logging Spool
0   libsystem_kernel.dylib        	0x00007fff6ad89e36 semaphore_wait_trap + 10
1   com.apple.audio.caulk         	0x00007fff6481cb16 caulk::mach::semaphore::wait() + 16
2   com.apple.audio.caulk         	0x00007fff6481c9b2 caulk::semaphore::timed_wait(double) + 106
3   com.apple.audio.caulk         	0x00007fff6481c7c4 caulk::concurrent::details::worker_thread::run() + 30
4   com.apple.audio.caulk         	0x00007fff6481c1e4 void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*> > >(void*) + 45
5   libsystem_pthread.dylib       	0x00007fff6ae4d109 _pthread_start + 148
6   libsystem_pthread.dylib       	0x00007fff6ae48b8b thread_start + 15

Thread 4:
0   libsystem_kernel.dylib        	0x00007fff6ad89e36 semaphore_wait_trap + 10
1   com.apple.audio.caulk         	0x00007fff6481cb16 caulk::mach::semaphore::wait() + 16
2   com.apple.audio.caulk         	0x00007fff6481c9b2 caulk::semaphore::timed_wait(double) + 106
3   com.apple.audio.caulk         	0x00007fff6481c7c4 caulk::concurrent::details::worker_thread::run() + 30
4   com.apple.audio.caulk         	0x00007fff6481c1e4 void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*> > >(void*) + 45
5   libsystem_pthread.dylib       	0x00007fff6ae4d109 _pthread_start + 148
6   libsystem_pthread.dylib       	0x00007fff6ae48b8b thread_start + 15

Thread 5:
0   libsystem_kernel.dylib        	0x00007fff6ad89dfa mach_msg_trap + 10
1   libsystem_kernel.dylib        	0x00007fff6ad8a170 mach_msg + 60
2   com.apple.audio.midi.CoreMIDI 	0x00007fff31a35635 XServerMachPort::ReceiveMessage(int&, void*, int&) + 95
3   com.apple.audio.midi.CoreMIDI 	0x00007fff31a52fee MIDIProcess::RunMIDIInThread() + 104
4   com.apple.audio.midi.CoreMIDI 	0x00007fff31a51d5e XThread::RunHelper(void*) + 10
5   com.apple.audio.midi.CoreMIDI 	0x00007fff31a35331 CAPThread::Entry(CAPThread*) + 77
6   libsystem_pthread.dylib       	0x00007fff6ae4d109 _pthread_start + 148
7   libsystem_pthread.dylib       	0x00007fff6ae48b8b thread_start + 15

Thread 6 Crashed:
0   libsystem_kernel.dylib        	0x00007fff6ad9033a __pthread_kill + 10
1   libsystem_pthread.dylib       	0x00007fff6ae4ce60 pthread_kill + 430
2   libsystem_c.dylib             	0x00007fff6ad17808 abort + 120
3   libc++abi.dylib               	0x00007fff67f76458 abort_message + 231
4   libc++abi.dylib               	0x00007fff67f678bf demangling_terminate_handler() + 262
5   libobjc.A.dylib               	0x00007fff69aa25a9 _objc_terminate() + 96
6   libc++abi.dylib               	0x00007fff67f75887 std::__terminate(void (*)()) + 8
7   libc++abi.dylib               	0x00007fff67f78387 __cxa_rethrow + 99
8   libwx_baseu_release-3.1.3.0.0.dylib	0x0000000103481677 wxCFEventLoop::DoRun() + 119
9   libwx_baseu_release-3.1.3.0.0.dylib	0x00000001033e0a15 wxEventLoopBase::Run() + 85
10  libwx_osx_cocoau_release_core-3.1.3.0.0.dylib	0x00000001035ede29 wxDialog::ShowModal() + 105
11  libwx_osx_cocoau_release_qa-3.1.3.0.0.dylib	0x0000000103e9ecef wxDebugReportPreviewStd::Show(wxDebugReport&) const + 47
12  Audacity                      	0x0000000101a4b9d6 CrashReport::Generate(wxDebugReport::Context) + 1734
13  Audacity                      	0x00000001019c393e AudacityApp::OnFatalException() + 14
14  libwx_baseu_release-3.1.3.0.0.dylib	0x00000001034cdb7c wxFatalSignalHandler(int) + 28
15  libsystem_platform.dylib      	0x00007fff6ae415fd _sigtramp + 29
16  ???                           	0x0000000000004007 0 + 16391
17  Audacity                      	0x0000000102377f54 soxr_process + 676
18  Audacity                      	0x0000000101ba701c Resample::Process(double, float*, unsigned long, bool, float*, unsigned long) + 140
19  Audacity                      	0x0000000101b04ebe Mixer::MixVariableRates(int*, WaveTrackCache&, sampleCount*, float*, int*, int*, Resample*) + 478
20  Audacity                      	0x0000000101b036bb Mixer::Process(unsigned long) + 763
21  Audacity                      	0x00000001019dc604 AudioIO::FillBuffers() + 1652
22  Audacity                      	0x00000001019dbed1 AudioThread::Entry() + 81
23  Audacity                      	0x00000001019e09e9 AudioThread::callback(void*) + 9
24  libsystem_pthread.dylib       	0x00007fff6ae4d109 _pthread_start + 148
25  libsystem_pthread.dylib       	0x00007fff6ae48b8b thread_start + 15

Thread 7:
0   libsystem_kernel.dylib        	0x00007fff6ad8c756 __semwait_signal + 10
1   libsystem_c.dylib             	0x00007fff6ad0feea nanosleep + 196
2   Audacity                      	0x00000001019dd59c MidiThread::Entry() + 76
3   Audacity                      	0x00000001019e09e9 AudioThread::callback(void*) + 9
4   libsystem_pthread.dylib       	0x00007fff6ae4d109 _pthread_start + 148
5   libsystem_pthread.dylib       	0x00007fff6ae48b8b thread_start + 15

Thread 8:
0   libsystem_pthread.dylib       	0x00007fff6ae48b68 start_wqthread + 0

Thread 9:
0   libsystem_pthread.dylib       	0x00007fff6ae48b68 start_wqthread + 0

Thread 10:
0   libsystem_kernel.dylib        	0x00007fff6ad89e4e semaphore_timedwait_trap + 10
1   libdispatch.dylib             	0x00007fff6abefb6b _dispatch_sema4_timedwait + 76
2   libdispatch.dylib             	0x00007fff6abeff97 _dispatch_semaphore_wait_slow + 58
3   libdispatch.dylib             	0x00007fff6abfd795 _dispatch_worker_thread + 284
4   libsystem_pthread.dylib       	0x00007fff6ae4d109 _pthread_start + 148
5   libsystem_pthread.dylib       	0x00007fff6ae48b8b thread_start + 15

Thread 6 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x000070000b64a000  rcx: 0x000070000b6480e8  rdx: 0x0000000000000000
  rdi: 0x000000000001c50b  rsi: 0x0000000000000006  rbp: 0x000070000b648110  rsp: 0x000070000b6480e8
   r8: 0x000070000b647fb0   r9: 0x000070000b648180  r10: 0x000070000b64a000  r11: 0x0000000000000246
  r12: 0x000000000001c50b  r13: 0x0000003000000008  r14: 0x0000000000000006  r15: 0x0000000000000016
  rip: 0x00007fff6ad9033a  rfl: 0x0000000000000246  cr2: 0x00007f9afbb75208
  
Logical CPU:     0
Error Code:      0x02000148
Trap Number:     133

Do your WAV and MP3 files have different sample rates?
– Bill

Yes, they typically do. They’re also typically a mixture of mono and stereo tracks.

For the project that crashes reliably, could you describe each track - mono/stereo, WAV/MP3, and sample rate. I can’t reproduce the crash with a mono 44100 WAV and a stereo 48000 MP3 arranged as you describe.
– Bill

Certainly.

Project is 32,000Hz.
Track 1 (recorded voice into Audacity) is stereo 32,000Hz.
Track 2 (imported WAV) is mono 32,000Hz.
Track 3 (imported MP3) is stereo 44,100Hz.

To trigger the crash, try re-arranging the tracks and/or adjusting the gain on the MP3 track.

Thanks. I can cause the crash reliably. I’ll be putting in a bug report for this.

The cause is almost definitely due to having tracks with different sample rates.

Workaround: after bringing in your MP3 track (at 44100), select the track then do Tracks > Resample and choose 32000 in the dialog. Now all your tracks are at the same sample rate and the crash should not occur (it doesn’t for me when I follow these steps).

– Bill

Is there a reason why you are using a project sample rate of 32000? That will produce a very muffled recording, especially of any music you use. You’d be much better off using 44100, which is pretty much the standard.
– Bill

Thanks Bill, I really appreciate it!

As to why 32000… that was totally an oversight on my part. It seems Zoom is saving audio recordings in 32000hz and when that was the first file I imported into Audacity, I think it matched the project sample rate to the file I imported, and I didn’t notice.

In that case I’d 1) set the Zoom to record at 44100, 2) resample the 32000 tracks to 44100 and 3) set the project rate to 44100.

– Bill