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

Audacity Bugzilla



Bug 2135 - Audacity crashes if launched with a locked pluginregistry.cfg file
Audacity crashes if launched with a locked pluginregistry.cfg file
Status: RESOLVED FIXED
Product: Audacity
Classification: Unclassified
Component: Application Core
2.3.3
Per OS Other
: P3 RepeatableAll
Assigned To: Default Assignee for New Bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-06-18 09:02 UTC by Peter Sampson
Modified: 2021-02-02 10:14 UTC (History)
7 users (show)

See Also:
Steps To Reproduce:
1) Lock the pluginregistry.cfg file Read-only 2) try to launch Audacity 3) Observe: Audacity crashes
Release Note:
Group: Problems reopening, saving or crashing in projects *If your pluginregistry.cfg file becomes locked then when you next launch Audacity the application will crash. Note that this should not happen in normal circumstances, but some virus checker apps have been know to lock the file.
First Git SHA:
Group: ---
Workaround:
Unlock your pluginregistry.cfg file - please see: https://manual.audacityteam.org/man/faq_installation_and_plug_ins.html#reset
Closed: 2021-02-02 00:00:00
petersampsonaudacity: Test‑OK‑Win+
petersampsonaudacity: Test‑OK‑Mac+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Sampson 2019-06-18 09:02:45 UTC
Happens on both W10 and Mac with 2.3.3 alphas (and earlier - so not a regression)
so assume all platforms

Yes it is unusual for pluginregistry.cfg to be locked read-only (not many users will idly lock it) - but Gale pointed out in Bug #1264
>The problem could occur due to interaction with a virus checker 
>(this is most likely on Windows) or due to permissions problems. 

See also Bug #1264
Comment 1 Peter Sampson 2019-06-18 09:11:27 UTC
We could, of course, just unlock the pluginregistry.cfg file - I would prefer this approach.  

Or we may wish to have a warning or info dialog asking the user if they want their audacity.cfg to be unlocked.
Comment 2 Peter Sampson 2019-06-18 09:13:34 UTC
Also crashes if you

1) Launch Audacity
2) lock the pluginregistry.cfg
3) Effect > Add / Remove Plug-ins...
4) Crash
Comment 3 Paul L 2019-06-28 10:55:16 UTC
Fixed minimally at

https://github.com/audacity/audacity/commit/1fa46eb0850470d1fcda5d80cfc208f480a46f19

This fix just makes a warning message.

(And strictly speaking this wasn't a crash:  the Audacity program was exiting gracefully, just giving no indication why)
Comment 4 Paul L 2019-06-28 11:02:42 UTC
I do not understand why this was distinct from bug 2134
Comment 5 Peter Sampson 2019-06-29 09:31:10 UTC
(In reply to Paul L from comment #4)
>I do not understand why this was distinct from bug 2134

Because different config files are involved and though they may be close cousins - from a QA and user perspective they are different .

Indeed the supposed "fix" for 2134 - does not lead to this bug being fixed.
Comment 6 Peter Sampson 2019-06-29 09:33:06 UTC
Testing on W10 with audacity-2.3.3-alpha-277-bdcb55467f725ad6e138a54da7e76244d3cc81eb

Still crashes at Step 3
Comment 7 Peter Sampson 2019-06-30 12:14:22 UTC
Testing on macOS 10.14.5 Mojave with alpha 2.3.3 jc002 of 30Jun19

As with Windows I get an immediate crash.

I looks like a couple of temp files are created but they are immediately removed
Comment 8 Paul L 2019-07-14 09:08:10 UTC
Foolish me, I didn't read the description closely.

Now I see the crash happens here:

   // Create/Open the registry
   wxFileConfig registry(wxEmptyString, wxEmptyString, FileNames::PluginRegistry());

   // Clear it out
   registry.DeleteAll();

   // Write the version string
   registry.Write(REGVERKEY, REGVERCUR);

And I could also blame wxWidgets for a bug.  TheDeleteAll() call returns false, which our code ignores, but leaves wxFileConfig in an inconsistent state that causes Write to crash within wxWidgets.
Comment 9 Paul L 2019-07-14 09:13:20 UTC
(In reply to Paul L from comment #8)

... and if I try to make the function return after detecting that DeleteAll failed, then wxWidgets crashes anyway in the destructor of wxFileConfig!

So is this not fixable short of rebuilding our wxWidgets with some source code changes?
Comment 10 Peter Sampson 2019-07-27 10:10:52 UTC
Demoting to P2 as this is not caused in normal usage of Audacity - possible use cases are:
a) Virus checker locks the file

b) user locks the file thinking that it protects contents from change
Comment 11 Peter Sampson 2019-08-22 06:33:06 UTC
Demoted to P3 with a Release Note and Worraound as this file should not become locked in normal use of Audacity.
Comment 12 Leland Lucius 2021-01-23 10:10:53 UTC
Near as I can tell, this no longer crashes.  You do get a few error dialogs, but Audacity does exit gracefully without a crash.
Comment 13 Peter Sampson 2021-01-23 12:37:02 UTC
Testing on W10 with Audacity 3.0.0 4e6e3c2

I still get a crash, but I gad to click my shotcit icon several times - the first couple of times nothing at all happened.
Comment 14 Leland Lucius 2021-01-28 21:05:45 UTC
Fix in:

https://github.com/audacity/audacity/commit/9e5ec6d
Comment 15 Peter Sampson 2021-01-29 17:17:53 UTC
Testing on W10 with Audacity 3.0.0 6c44b4f

This now does not crash - but ...

Immediately on launch you get the error message
>The plugin registry file is not wtiteable:
>C:\Users\Peter\AppData\Roaming\audacity\pluginregistry.cfg
>Settings were not sabed.

Clicking the OK button Audacity proceeds to launch.

BUT observe in Windows Explorer:  that the plginregistry.cfg has not been unlocked


So marking this REOPENED for this residual
Comment 16 Peter Sampson 2021-01-29 17:27:49 UTC
Worse Still.

After that last test I:
a) purge the entire contents of mu audacity settings folder
b) relaunch Audacity 3.0.0 6c44b4f
c) Observe: I get the error message
>The plugin registry file is not writeable:
>C:\Users\Peter\AppData\Roaming\audacity\pluginregistry.cfg
>Settings were not saved.

BUT after step a) there is no extant pluginregistry.cfg file 


If I then try to launch 2.4.2 this opens fine with no error message  
I can then open Audacity 3.0.0 6c44b4f without the error message.
Comment 17 Leland Lucius 2021-01-29 19:18:06 UTC
(In reply to Peter Sampson from comment #16)
> Worse Still.
> 
> After that last test I:
> a) purge the entire contents of mu audacity settings folder
> b) relaunch Audacity 3.0.0 6c44b4f
> c) Observe: I get the error message
> >The plugin registry file is not writeable:
> >C:\Users\Peter\AppData\Roaming\audacity\pluginregistry.cfg
> >Settings were not saved.
> 
> BUT after step a) there is no extant pluginregistry.cfg file 
> 
> 
> If I then try to launch 2.4.2 this opens fine with no error message  
> I can then open Audacity 3.0.0 6c44b4f without the error message.

HAHAHAHA!  (and DOH!)  Didn't think about that situation.  Easy to fix.
Comment 18 Leland Lucius 2021-01-29 19:30:35 UTC
(In reply to Peter Sampson from comment #15)
> Testing on W10 with Audacity 3.0.0 6c44b4f
> 
> This now does not crash - but ...
> 
> Immediately on launch you get the error message
> >The plugin registry file is not wtiteable:
> >C:\Users\Peter\AppData\Roaming\audacity\pluginregistry.cfg
> >Settings were not sabed.
> 
> Clicking the OK button Audacity proceeds to launch.
> 
> BUT observe in Windows Explorer:  that the plginregistry.cfg has not been
> unlocked
> 
I simply check to see if it's writable. What do you suggest we do to unlock it? If we just delete it, the user would lose their choices of plugins. We could try resetting the writable permission, but what if it's on a read only filesystem?

I figured we just let the user know and let them figure it out. Maybe we need a firmer error message and quit Audacity rather than continuing initialization?
Comment 19 Peter Sampson 2021-01-30 11:00:03 UTC
One important thing is that the message does not have a "?" help button.  It would need a new error page in the Manual (I can do that).  Note that the error message just says "unwritable" it doesn't mention "locking" - but if we have a help button we can deal with that on the error/help page

I am unsure of the best approach - I have written a QA email thread for discussion.

1) For now I think the immediate safest thing to do is abort the launch after the user clicks the OK button in the message.

2) An improved option would be:
Change the error message so that it offers to unlock the file for the user with a YES/NO - and No would then lead to an aborted launch.
Comment 20 Peter Sampson 2021-01-30 11:02:06 UTC
(In reply to Peter Sampson from comment #19)
>1) For now I think the immediate safest thing to do is abort the launch 
>after the user clicks the OK button in the message.

It's basically unsafe to proceed because if the user then or later tries to unable/disable/add plug-ins they will be blocked.
Comment 21 Leland Lucius 2021-01-31 10:28:22 UTC
Fix in:

https://github.com/audacity/audacity/commit/21296b0

Seems to work fine, but I need Paul's with setting up an exception to exit Audacity a bit more gently.
Comment 22 Peter Sampson 2021-01-31 11:33:22 UTC
(In reply to Leland Lucius from comment #21)

Tested on W10 with Audacity 3.0.0 21296b0

This now works properly on Windows, with
a) an improved message
b) help button in the message
c) no launch while the problem remains
d) fixing the problem by unlocking and then using the Retry button proceeds to launch
e) the Quit Audacity button - "does what it says on the tin"
Comment 23 Peter Sampson 2021-01-31 12:46:22 UTC
(In reply to Leland Lucius from comment #21)

Tested on macOS 11.1 Big Sur with Audacity 3.0.0 21296b0

This now works properly on Mac, with
a) an error message
b) help button in the message
c) no launch while the problem remains
d) fixing the problem by unlocking and then using the Retry button proceeds to launch
e) the Quit Audacity button - "does what it says on the tin"
Comment 24 Peter Sampson 2021-02-01 18:28:01 UTC
REOPENED for Residual crash on Mac

1) Finder
2) Right click on file
3) Select Get Info

In the top block "General" (you may need to expand it)there is a checkbox for locked.

This same crash also happens with a "Locked" and the unlocked pluginsettings.cfg - see Bug #2652

It does not happen with a locked and then unlocked audacity.cfg file

And yes, repeatable - every time.
Comment 25 Leland Lucius 2021-02-02 02:18:36 UTC
This is the same problem that was causing bug #1561, though the fix for that one may have been a little heavy handed and could have been fixed the same way as this one.

This particular crash is happening because the OnInit() routine was split into two routines and the InitPart2() runs after OnInit() exits. When that happens the "Exist On Frame Delete" flag for the Mac is reset and whenever the first displayed dialog (the configuration file retry dialog in this case) is deleted, Audacity proceeds to exit.

Simple fix committed in:

https://github.com/audacity/audacity/commit/4f7affad3f73d9fed71fefa4169949a489a40b26
Comment 26 Peter Sampson 2021-02-02 10:14:29 UTC
(In reply to Leland Lucius from comment #25)
Testing on macOS 11.1 Big Sur with Audacity 3.0.0 392360a

This Now works properly with locking via
a) the "Locked" checkbox in Finder>Get Info, or
b) setting the file "Read Only"  in Finder>Get Info


Also rechecked that this still works on W10 with this latest build - it does.