Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audacity freezes when quickly starting and stopping playback #3699

Closed
LWinterberg opened this issue Sep 27, 2022 · 7 comments · Fixed by #3721
Closed

Audacity freezes when quickly starting and stopping playback #3699

LWinterberg opened this issue Sep 27, 2022 · 7 comments · Fixed by #3721
Assignees
Labels
bug An error, undesired behaviour, or missed functionality crash / freeze catastrophic errors P2 High priority

Comments

@LWinterberg
Copy link
Member

Bug description

No response

Steps to reproduce

  1. have a track
  2. mash spacebar to send many start and stop instructions
  3. freeze

Expected behavior

When more inputs are sent than Audacity can process, additional inputs should be discarded.

Actual behavior

No response

Audacity Version

latest stable version (from audacityteam.org/download)

Operating system

Windows

Additional context

I've seen two users report this bug on socials and forum, so it's at least slightly frequently encountered.

When I pause Audacity in the VSCode debugger after it hits the freeze, I end up with the following call stack:

view call stack

image

ntdll.dll!00007ffd30924204() (Unknown Source:0)
ntdll.dll!00007ffd308db873() (Unknown Source:0)
KernelBase.dll!00007ffd2dd9b391() (Unknown Source:0)
msvcp140d.dll!00007ffc91302ede() (Unknown Source:0)
Audacity.exe!std::this_thread::sleep_until<std::chrono::steady_clock,std::chrono::duration<__int64,std::ratio<1,1000000000>>>(const std::chrono::time_point<std::chrono::steady_clock,std::chrono::duration<__int64,std::ratio<1,1000000000>>> & _Abs_time) Line 201 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\thread:201)
Audacity.exe!std::this_thread::sleep_for<__int64,std::ratio<1,1000>>(const std::chrono::duration<__int64,std::ratio<1,1000>> & _Rel_time) Line 207 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\thread:207)
Audacity.exe!AudioIoCallback::WaitForAudioThreadStopped() Line 3246 (c:\Users\mc\Documents\GitHub\audacity\src\AudioIO.cpp:3246)
Audacity.exe!AudioIO::StopStream() Line 1408 (c:\Users\mc\Documents\GitHub\audacity\src\AudioIO.cpp:1408)
Audacity.exe!ProjectAudioManager::Stop(bool stopStream) Line 531 (c:\Users\mc\Documents\GitHub\audacity\src\ProjectAudioManager.cpp:531)
Audacity.exe!TransportUtilities::DoStopPlaying(const CommandContext & context) Line 163 (c:\Users\mc\Documents\GitHub\audacity\src\TransportUtilities.cpp:163)
Audacity.exe!TransportActions::Handler::OnPlayDefaultOrStop(const CommandContext & context) Line 184 (c:\Users\mc\Documents\GitHub\audacity\src\menus\TransportMenus.cpp:184)
Audacity.exe!CommandManager::HandleCommandEntry(AudacityProject & project, const CommandListEntry * entry, std::bitset<64> flags, bool alwaysEnabled, const wxEvent * evt, const CommandContext * pGivenContext) Line 1269 (c:\Users\mc\Documents\GitHub\audacity\src\commands\CommandManager.cpp:1269)
Audacity.exe!CommandManager::FilterKeyEvent(AudacityProject * project, const wxKeyEvent & evt, bool permit) Line 1190 (c:\Users\mc\Documents\GitHub\audacity\src\commands\CommandManager.cpp:1190)
Audacity.exe!<lambda_6>::operator()(wxKeyEvent & key) Line 1713 (c:\Users\mc\Documents\GitHub\audacity\src\commands\CommandManager.cpp:1713)
Audacity.exe!std::invoke<<lambda_6> &,wxKeyEvent &>(<lambda_6> & _Obj, wxKeyEvent & _Arg1) Line 1573 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\type_traits:1573)
Audacity.exe!std::_Invoker_ret<bool>::_Call<<lambda_6> &,wxKeyEvent &>(<lambda_6> & _Func, wxKeyEvent & <_Vals_0>) Line 672 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\functional:672)
Audacity.exe!std::_Func_impl_no_alloc<<lambda_6>,bool,wxKeyEvent &>::_Do_call(wxKeyEvent & <_Args_0>) Line 832 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\functional:832)
Audacity.exe!std::_Func_class<bool,wxKeyEvent &>::operator()(wxKeyEvent & <_Args_0>) Line 879 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\functional:879)
Audacity.exe!GlobalHook<KeyboardCapture::PostFilter,bool __cdecl(wxKeyEvent &)>::Call<wxKeyEvent &>(wxKeyEvent & <arguments_0>) Line 162 (c:\Users\mc\Documents\GitHub\audacity\libraries\lib-utility\GlobalVariable.h:162)
Audacity.exe!`EventMonitor::FilterEvent'::`2'::<lambda_1>::operator()() Line 216 (c:\Users\mc\Documents\GitHub\audacity\src\KeyboardCapture.cpp:216)
@LWinterberg LWinterberg added bug An error, undesired behaviour, or missed functionality P2 High priority crash / freeze catastrophic errors labels Sep 27, 2022
@LWinterberg LWinterberg added this to the Audacity 3.2.x milestone Sep 27, 2022
@Paul-Licameli
Copy link
Collaborator

I suggest @pietro68 investigate this one

@pietro68 pietro68 self-assigned this Sep 27, 2022
@pietro68
Copy link
Contributor

I can not reproduce this. I tried with a Windows x64 vc2019, both Debug and Release.
Tried generating a mono noise track, then pressing the space bar many times as fast as possible.

@crsib
Copy link
Contributor

crsib commented Sep 27, 2022

I wonder if it depends on the Host type. I don't observe it on WASAPI, but I've reproduced it instantly on MME.

@pietro68
Copy link
Contributor

I don't observe it on WASAPI, but I've reproduced it instantly on MME.

could you please tell me if you used a Debug or a Release build. I can not reproduce it using either MME or Directsound.

@crsib
Copy link
Contributor

crsib commented Sep 27, 2022

I've reproduced it in Debug build

@MagisterX
Copy link

I have encountered similar issue in 3.2. It's very easy to reproduce if you place playhead after audio track and click on play button or press space. Audacity will instantly freeze.
I tried to do the same with latest master build in Debug build and it was almost impossible to reproduce for some reason.
In my case one thread stuck in while condition of AudioIoCallback::WaitForAudioThreadStopped() method from AudioIO.cpp.
I tweaked values in debugger to bypass condition and Audacity unfreeze after that.
I used WASAPI. Also replicated on MME but not with DirectSound.

2022-09-25.15-25-36AVC.mp4

@petersampsonaudacity
Copy link

See also: Crash via left clicking play head bar and pushing space bar to play #3716

@crsib crsib assigned crsib and unassigned pietro68 Sep 29, 2022
@LWinterberg LWinterberg linked a pull request Sep 30, 2022 that will close this issue
6 tasks
@dozzzzer dozzzzer self-assigned this Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error, undesired behaviour, or missed functionality crash / freeze catastrophic errors P2 High priority
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

8 participants