Audacity Bug Summary
••• Introduction •••
••• Keywords •••
    Audacity 3.0.3 development began 19th April 2021

Audacity Bugzilla



Bug 379 - Nyquist scripts that trigger Nyquist exit (e.g. random(0)) exit audacity without saving
Nyquist scripts that trigger Nyquist exit (e.g. random(0)) exit audacity with...
Status: RESOLVED FIXED
Product: Audacity
Classification: Unclassified
Component: Nyquist
1.3.14 alpha
Per OS All
: P2 Repeatable
Assigned To: Steve Daulton
http://sourceforge.net/mailarchive/fo...
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-04-22 16:43 UTC by James Crook
Modified: 2021-07-12 11:17 UTC (History)
7 users (show)

See Also:
Steps To Reproduce:
Create a .ny script that includes either the command (random 0) or (exit), Generate a 30s chirp Invoke the Nyquist script. Audacity exits without saving.
Release Note:
GROUP:Effects and Analysis Invalid Nyquist scripts (scripts with the .ny suffix) can cause Audacity to exit without saving.
First Git SHA:
Group: ---
Workaround:
Closed: 2021-07-12 00:00:00
stevethefiddle: Regression+
petersampsonaudacity: Test‑OK‑Win+
petersampsonaudacity: Test‑OK‑Win+


Attachments
specific patch from Roger to fix (random 0) crash and remove EXIT (951 bytes, patch)
2011-04-23 01:09 UTC, Gale Andrews
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Crook 2011-04-22 16:43:51 UTC
See steps to reproduce.

The bug is believed by James to be easy to fix.
Comment 1 Gale Andrews 2011-04-23 01:09:17 UTC
Created attachment 163 [details]
specific patch from Roger to fix (random 0) crash and remove EXIT
Comment 2 Gale Andrews 2011-04-23 01:12:36 UTC
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.
Comment 3 Gale Andrews 2011-04-23 01:22:35 UTC
Patch prevents crash on random(0) or (exit) on Windows.
Comment 4 James Crook 2011-04-23 06:24:14 UTC
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.
Comment 5 Steve Daulton 2011-04-23 09:04:51 UTC
(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?
Comment 6 Roger Dannenberg 2011-04-23 10:13:41 UTC
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.
Comment 7 James Crook 2011-04-23 10:21:03 UTC
+1 on Roger's comment #6.  

Enhancement issue for a general 'fail safe' is optional.  Energy is better spent on fixing root causes.
Comment 8 Gale Andrews 2011-04-23 16:54:01 UTC
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.
Comment 9 Steve Daulton 2021-07-11 11:38:29 UTC
The Nyquist command "(exit)" crashes Audacity again.

This regression appears to have been reintroduced by: https://github.com/audacity/audacity/commit/9fb0ce5b8279edfe8d01bc3344535017e05160ad
Comment 10 Steve Daulton 2021-07-11 12:01:37 UTC
Assigned to myself.
Comment 11 Steve Daulton 2021-07-11 12:09:20 UTC
Elevated to P2 as it is crash (and a regression).
Comment 12 Steve Daulton 2021-07-11 12:10:15 UTC
Fix sent as pull request: https://github.com/audacity/audacity/pull/1275
Comment 13 Steve Daulton 2021-07-12 09:13:53 UTC
(In reply to Steve Daulton from comment #12)
Fix committed:
https://github.com/audacity/audacity/commit/c216f464
Comment 14 Peter Sampson 2021-07-12 11:15:18 UTC
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
Comment 15 Peter Sampson 2021-07-12 11:17:03 UTC
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