Repository navigation
11604 mark plugins that crash audacity as broken - #11647
saintmatthieu merged 2 commits into
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 519a526e2decf58ce9feb84e5b7e865b5925a9ff and f692344. 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
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
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Warning Review ran into problems🔥 ProblemsLinked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped 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. Comment |
There was a problem hiding this comment.
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)
musesrc/effects/effects_base/internal/au3effectloader.cppsrc/effects/effects_base/internal/au3effectloader.hsrc/effects/effects_base/internal/effectsutils.cpp
There was a problem hiding this comment.
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
IAudioPluginsLoadGuardinAu3EffectLoaderto 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 callendLoad(...)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.
| if (au3path.empty()) { | ||
| loadGuard()->endLoad(effectId.toStdString()); | ||
| LOGE() << "Failed to find plugin path for effect: " << effectId; | ||
| return false; | ||
| } |
There was a problem hiding this comment.
that's the missing plugin path right?
There was a problem hiding this comment.
effectId ? Not just the path, other stuff, too.
There was a problem hiding this comment.
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.
|
|
||
| // The load call returned, so whatever the outcome, the plugin did not | ||
| // crash the application. | ||
| loadGuard()->endLoad(effectId.toStdString()); | ||
|
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
shouldn't the begin/end load helpers wrap that entire ensurePluginIsLoaded method? here it reads interleaved
There was a problem hiding this comment.
Now that the if is gone, it looks simpler. Now it wraps the FindPluginsAtPath method, the one that risks crashing.
There was a problem hiding this comment.
wraps DiscoverPluginsAtPath and LoadPlugin but I guess it's ok right?
ce83e9a to
a7728fe
Compare
There was a problem hiding this comment.
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
| loadGuard()->endLoad(effectId.toStdString()); | ||
|
|
||
| m_loadedInterfaces.emplace(effectId, m_pluginProvider.LoadPlugin(au3path)); | ||
|
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Ah, crap - indeed, it's LoadPlugin the place that risks crashing.
Doesn't hurt to wrap both.
@luapmartin FYI
a7728fe to
519a526
Compare
519a526 to
f692344
Compare
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
Resolves: #11604
Integration of framework PR #11604, plus a few lines of integration.
Recommended:
QA:
Try this (on MacOS):
/Library/Audio/Plug-ins/VST3/,{ "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" },