Bugzilla – Bug 379
Nyquist scripts that trigger Nyquist exit (e.g. random(0)) exit audacity without saving
Last modified: 2021-07-12 11:17:03 UTC
See steps to reproduce. The bug is believed by James to be easy to fix.
Created attachment 163 [details] specific patch from Roger to fix (random 0) crash and remove EXIT
Roger wrote on -quality: On the larger question, if Nyquist OR Audacity OR any plug-in or library tries to divide by zero or dereference a bogus pointer, we're pretty much hosed. We could probably trap some of these errors and then strongly suggest that the user shut down and restart, especially if we could isolate the error to Nyquist or some library. I'm not confident I could make this work correctly and reliably. Nyquist and other libraries only get called when Audacity is trying to do something with audio, so we're talking about interrupting and aborting an Audacity command without corrupting any Audacity data structures.
Patch prevents crash on random(0) or (exit) on Windows.
Patch applied. DEVEL-FIX-MADE SVN Rev 11120 The wider issue of safety on exceptions (like divide by zero) in Nyquist and indeed other plug-ins, would be a new enhancement request.
(In reply to comment #4) With SVN Rev 11120 on Ubuntu 10.10 As expected; (random 0) returns "0" (exit) returns "unbound function" "divide by zero" errors in Nyquist are already appear to be handled correctly, that is they return an error but do not crash Nyquist. The specific issue raised in this bug appears to be fixed. Is a (low priority) bug required for the general case of handling Nyquist crashing, or can that wait until another case of Nyquist crashing is found?
The general case of handling Nyquist crashing is a special case of recovering from failures in Audacity. When we discover something that crashes Audacity, it is much easier to fix the particular bug than to isolate the failing component from the rest of Audacity. Currently, there are no recovery mechanisms in Audacity for ANY hard failures other than: terminate, restart, reload project data from disk. So a general "recover and keep running" approach sounds like a major feature, enhancement, or design change rather than a bug fix. That would only make sense if Nyquist (and other libraries) caused so many sporadic crashes that it would be better to focus development time on isolating Audacity from these threats rather than simply fix bugs as they are discovered.
+1 on Roger's comment #6. Enhancement issue for a general 'fail safe' is optional. Energy is better spent on fixing root causes.
Thanks, all. I assume we don't need to worry about Mac not behaving so, RESOLVED - FIXED. I'm not going to raise an enhancement ATM for fail safe recovery from external failures, given this seems difficult/expensive, and given we have (we hope) a pretty good Automatic Crash Recovery feature now. Anyone who feels strongly could raise a P4/P5 review I guess.
The Nyquist command "(exit)" crashes Audacity again. This regression appears to have been reintroduced by: https://github.com/audacity/audacity/commit/9fb0ce5b8279edfe8d01bc3344535017e05160ad
Assigned to myself.
Elevated to P2 as it is crash (and a regression).
Fix sent as pull request: https://github.com/audacity/audacity/pull/1275
(In reply to Steve Daulton from comment #12) Fix committed: https://github.com/audacity/audacity/commit/c216f464
Testing on W10 with latest alpha master build: audacity-win-3.0.4-alpha-20210712+c216f46-64bit 1. Audacity 3.0.2 (or 3.0.3 RC) In the Nyquist Prompt, run the command: (exit) 2. Observer that Audacity crashes. 3. Audacity 3.0.4 c216f464 or later: In the Nyquist Prompt, run the command: (exit) 4. Observe that Audacity does not crash. 5. Bonus point: Run the "(exit)" command using the Debug button in the Nyquist Prompt. 6. Observe error message: "error: unbound function - EXIT if continued: try evaluating symbol again 1>" Note that this fixes this issue for 3.0.4 but NOT for 3.0.3