Skip to content

11604 mark plugins that crash audacity as broken - #11647

Merged
saintmatthieu merged 2 commits into
audacity:masterfrom
saintmatthieu:11604-mark-plugins-that-crash-audacity-as-broken
Aug 12, 2026
Merged

saintmatthieu merged 2 commits into
audacity:masterfrom
saintmatthieu:11604-mark-plugins-that-crash-audacity-as-broken

Conversation

@saintmatthieu

@saintmatthieu saintmatthieu commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Resolves: #11604

Integration of framework PR #11604, plus a few lines of integration.

  • I signed CLA
  • The title of the pull request describes an issue it addresses
  • If changes are extensive, then there is a sequence of easily reviewable commits
  • Each commit's message describes its purpose and effects
  • There are no behavior changes unnecessary for the stated purpose of the PR

Recommended:

  • Each commit compiles and runs on my machine without known undesirable changes of behavior

QA:

Try this (on MacOS):

  • get an old BOREALIS MuseHub-distributed plugin from @saintmatthieu and paste it in /Library/Audio/Plug-ins/VST3/,
  • in your known_audio_plugins.json, add the entry
{
      "meta": {
        "attributes": {
          "activated": "true",
          "category": "None",
          "description": "n/a",
          "isRealtimeCapable": "true",
          "module": "Module__The Audacity Team_VST3 Effects_",
          "paramsAreInputAgnostic": "true",
          "title": "BOREALIS",
          "type": "Effect",
          "version": "1.6"
        },
        "id": "Effect_VST3_BOREALIS_/Library/Audio/Plug-ins/VST3/BOREALIS.vst3",
        "type": "VstPlugin",
        "vendor": "BABY Audio"
      },
      "path": "/Library/Audio/Plug-ins/VST3/BOREALIS.vst3",
      "state": "Validated"
    },
  • run Audacity. Open a project, find that effect and open it. You should get a "Missing authorization" dialog, and then the app should crash.
  • Start Audacity again. Reopen that project.
    • Look for the plugin: you shouldn't find it anymore.
    • In the Plugin manager, it should be listed as Broken.
  • Testflow test cases have been run

@saintmatthieu
saintmatthieu requested review from luapmartin and a lite review from Copilot August 11, 2026 11:37
@saintmatthieu saintmatthieu self-assigned this Aug 11, 2026
@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 4a7cea65-2402-4daa-88db-cd43af965d96

📥 Commits

Reviewing files that changed from the base of the PR and between 519a526e2decf58ce9feb84e5b7e865b5925a9ff and f692344.

📒 Files selected for processing (1)
  • muse

📝 Walkthrough

Walkthrough

Au3EffectLoader now injects IAudioPluginsLoadGuard and starts the guard before third-party plugin discovery. It ends the guard after discovery, then calls LoadPlugin without the previous empty-path early return. The muse submodule reference advances to commit a7422db9322a7e461692e280c7aca2654082eb40.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Au3EffectLoader
  participant IAudioPluginsLoadGuard
  participant PluginDiscovery
  participant LoadPlugin
  Au3EffectLoader->>IAudioPluginsLoadGuard: start persistent load-guard record
  Au3EffectLoader->>PluginDiscovery: discover third-party plugin path
  PluginDiscovery-->>Au3EffectLoader: return discovered path
  Au3EffectLoader->>IAudioPluginsLoadGuard: end load guard
  Au3EffectLoader->>LoadPlugin: load plugin
Loading
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The loader guard integration and Muse submodule update support recording plugin loads and clearing records after successful loads for issue #11604.
Out of Scope Changes check ✅ Passed The submodule update and loader changes are directly related to integrating the crash-detection behavior for issue #11604.
Title check ✅ Passed The title clearly identifies issue #11604 and the main change: marking plugins that crash Audacity as broken.
Description check ✅ Passed The description includes the issue link, motivation, required checklist, implementation details, and QA steps; the unchecked Testflow item is non-critical.

Warning

Review ran into problems

🔥 Problems

Linked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped musescore/musescore.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 7bd16c5b-1497-4907-9c2c-bb6581377439

📥 Commits

Reviewing files that changed from the base of the PR and between 96895fa and a37231f917b42ba6710d3ff84e2fa43813aa8f0e.

📒 Files selected for processing (4)
  • muse
  • src/effects/effects_base/internal/au3effectloader.cpp
  • src/effects/effects_base/internal/au3effectloader.h
  • src/effects/effects_base/internal/effectsutils.cpp

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR integrates crash-detection for third‑party effect/plugin loading by introducing a disk sentinel (via IAudioPluginsLoadGuard) so plugins that crash Audacity during load can be flagged as broken on the next launch. It also broadens effect type parsing to recognize an additional type string coming from the framework layer.

Changes:

  • Treat "Processor" as an alias for "Effect" when parsing effect types (EffectType::Processor).
  • Inject and use IAudioPluginsLoadGuard in Au3EffectLoader to leave/remove a “currently loading” sentinel around plugin discovery/load.
  • Add integration glue in AU3 effect loader to begin/end guarded load attempts.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/effects/effects_base/internal/effectsutils.cpp Accepts "Processor" in effectTypeFromString for broader type compatibility.
src/effects/effects_base/internal/au3effectloader.h Adds IAudioPluginsLoadGuard injection to the AU3 effect loader.
src/effects/effects_base/internal/au3effectloader.cpp Begins/ends guarded load attempts to support marking crashy plugins as broken on next launch.
Suppressed comments (1)

src/effects/effects_base/internal/au3effectloader.cpp:102

  • If LoadPlugin(...) throws, the sentinel file is left behind and the plugin may be marked broken on next launch even though the crash-detection mechanism is intended to trigger only when the process dies. Catch exceptions here to call endLoad(...) before rethrowing.
    m_loadedInterfaces.emplace(effectId, m_pluginProvider.LoadPlugin(au3path));

    // The load call returned, so whatever the outcome, the plugin did not
    // crash the application.
    loadGuard()->endLoad(effectId.toStdString());

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 92 to 96
if (au3path.empty()) {
loadGuard()->endLoad(effectId.toStdString());
LOGE() << "Failed to find plugin path for effect: " << effectId;
return false;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's the missing plugin path right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

effectId ? Not just the path, other stuff, too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replied below

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I completely misunderstood your question.
That's generated code that I again omitted to review. Thanks for doing my work.
I'll remove this if altogether, I don't like it. This PR just wants to know if the app crashed or not.

Comment on lines +99 to +103

// The load call returned, so whatever the outcome, the plugin did not
// crash the application.
loadGuard()->endLoad(effectId.toStdString());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that reads a bit counter intuitive that we remove the sentinel in charge of reporting plugin that can't load just before logging a failed to load plugin

Comment on lines 41 to 44

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the begin/end load helpers wrap that entire ensurePluginIsLoaded method? here it reads interleaved

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that the if is gone, it looks simpler. Now it wraps the FindPluginsAtPath method, the one that risks crashing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wraps DiscoverPluginsAtPath and LoadPlugin but I guess it's ok right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

@saintmatthieu
saintmatthieu force-pushed the 11604-mark-plugins-that-crash-audacity-as-broken branch 2 times, most recently from ce83e9a to a7728fe Compare August 11, 2026 15:20

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 4710f8d6-3c59-4caa-9abe-d8b6d24a7bd9

📥 Commits

Reviewing files that changed from the base of the PR and between a37231f917b42ba6710d3ff84e2fa43813aa8f0e and ce83e9a2d7232e76b882401b51df52b997000698.

📒 Files selected for processing (1)
  • src/effects/effects_base/internal/au3effectloader.cpp

Comment on lines +92 to +95
loadGuard()->endLoad(effectId.toStdString());

m_loadedInterfaces.emplace(effectId, m_pluginProvider.LoadPlugin(au3path));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Keep the load sentinel active through LoadPlugin.

endLoad runs at Line 92, before LoadPlugin runs at Line 94. If LoadPlugin crashes or fails, the sentinel has already been removed. The next startup cannot identify effectId as the failed plugin.

Move endLoad below the LoadPlugin call and the success check. Do not use cleanup that runs when plugin code throws.

Proposed fix
-    loadGuard()->endLoad(effectId.toStdString());
-
     m_loadedInterfaces.emplace(effectId, m_pluginProvider.LoadPlugin(au3path));
 
     if (!m_loadedInterfaces.at(effectId)) {
         LOGE() << "Failed to load plugin: " << effectId;
         m_loadedInterfaces.erase(effectId);
         return false;
     }
 
+    loadGuard()->endLoad(effectId.toStdString());

This repeats the unresolved guard-scope concern from the previous review context.

#!/bin/bash
set -euo pipefail

rg -n -C 12 \
  'IAudioPluginsLoadGuard|beginLoad\(|endLoad\(|DiscoverPluginsAtPath|LoadPlugin\(' \
  --glob '*.h' --glob '*.hpp' --glob '*.cpp' --glob '*.cxx'

Source: MCP tools

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, crap - indeed, it's LoadPlugin the place that risks crashing.
Doesn't hurt to wrap both.
@luapmartin FYI

@saintmatthieu
saintmatthieu force-pushed the 11604-mark-plugins-that-crash-audacity-as-broken branch from a7728fe to 519a526 Compare August 11, 2026 15:29
@saintmatthieu
saintmatthieu force-pushed the 11604-mark-plugins-that-crash-audacity-as-broken branch from 519a526 to f692344 Compare August 12, 2026 16:40
@saintmatthieu
saintmatthieu merged commit 1f099ec into audacity:master Aug 12, 2026
8 of 10 checks passed
@kryksyh kryksyh mentioned this pull request Aug 13, 2026
5 of 7 tasks
kryksyh added a commit that referenced this pull request Aug 13, 2026
Resolves: #11673

Restored path validation removed in #11647

<!-- Use "x" to fill the checkboxes below like [x] -->

- [x] I signed [CLA](https://www.audacityteam.org/cla/)
- [x] The title of the pull request describes an issue it addresses
- [x] If changes are extensive, then there is a sequence of easily
reviewable commits
- [x] Each commit's message describes its purpose and effects
- [x] There are no behavior changes unnecessary for the stated purpose
of the PR

Recommended:
- [ ] Each commit compiles and runs on my machine without known
undesirable changes of behavior

QA:

- [ ] Testflow test cases have been run
@saintmatthieu
saintmatthieu deleted the 11604-mark-plugins-that-crash-audacity-as-broken branch August 28, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mark plugins that crash Audacity as broken

3 participants