Invalidate plugins if they've crashed the app - #211
Conversation
|
/build |
|
Build dispatched: https://github.com/musescore/muse_framework/actions/runs/31399126365 |
📝 WalkthroughWalkthroughThe audio-plugin module adds a load-guard interface and sentinel-file implementation. VST module creation now records load start and completion. Initialization detects dangling loads from prior interrupted operations and marks matching plugins with 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@framework/audioplugins/audiopluginsmodule.cpp`:
- Around line 78-84: Update AudioPluginsContext::onInit to handle the failure
result from markCrashedPluginsAsBroken(). Propagate that failure through
initialization, or prevent subsequent normal plugin loading when recovery does
not succeed, ensuring a crashed plugin cannot be loaded again in the same run.
In `@framework/audioplugins/iaudiopluginsloadguard.h`:
- Around line 49-50: Update the IAudioPluginsLoadGuard::endLoad method to return
Ret instead of void, and propagate the sentinel cleanup result from its
implementations. Ensure callers check and handle cleanup failure—retrying or
resolving it before recovery consumes the record—so a successfully loaded plugin
is not later marked crashed by markCrashedPluginsAsBroken().
In `@framework/audioplugins/internal/audiopluginsloadguard.h`:
- Around line 37-41: Update
framework/audioplugins/internal/audiopluginsloadguard.h lines 37-41 so endLoad
reports cleanup failure; update its implementation in
framework/audioplugins/internal/audiopluginsloadguard.cpp lines 55-65 to
propagate the sentinel removal result and retry or durably record completion;
add coverage in framework/audioplugins/tests/audiopluginsloadguardtest.cpp lines
70-92 for failed removal and verify recovery does not classify a completed load
as PluginCrashedOnLoad.
In `@framework/audioplugins/tests/registeraudiopluginsscenariotest.cpp`:
- Around line 682-683: Require both recovery tests to verify the load-guard
query by replacing the ON_CALL stubs for m_loadGuard->danglingLoads() at
framework/audioplugins/tests/registeraudiopluginsscenariotest.cpp:682-683 and
:707-708 with EXPECT_CALL(...).WillOnce(...) using the existing crashed plugin
ID result.
In `@framework/vst/internal/vstmodulesrepository.cpp`:
- Around line 79-81: Check the return value of
loadGuard()->beginLoad(resourceId) and immediately return the failure before
invoking createModule(). Preserve the existing endLoad(resourceId) cleanup for
successful module creation.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: b067d4d8-f081-4628-bbb5-7aca56f941c2
📒 Files selected for processing (14)
framework/audioplugins/CMakeLists.txtframework/audioplugins/audiopluginserrors.hframework/audioplugins/audiopluginsmodule.cppframework/audioplugins/iaudiopluginsloadguard.hframework/audioplugins/internal/audiopluginsloadguard.cppframework/audioplugins/internal/audiopluginsloadguard.hframework/audioplugins/internal/registeraudiopluginsscenario.cppframework/audioplugins/internal/registeraudiopluginsscenario.hframework/audioplugins/tests/CMakeLists.txtframework/audioplugins/tests/audiopluginsloadguardtest.cppframework/audioplugins/tests/mocks/audiopluginsloadguardmock.hframework/audioplugins/tests/registeraudiopluginsscenariotest.cppframework/vst/internal/vstmodulesrepository.cppframework/vst/internal/vstmodulesrepository.h
|
/build |
|
Build dispatched: https://github.com/musescore/muse_framework/actions/runs/31406600268 |
luapmartin
left a comment
There was a problem hiding this comment.
looks nice, have you checked for disk access rights etc. on all platforms for writing and reading that sentinel file?
|
It's an interesting question, @luapmartin, hadn't thought about that. |
|
ok just add to QA to do a test run with denied access I guess then |
The sentinel file is saved in the application data directory, it is always writable to the app. |
It can be that a once validated plugin later crashes the application, like MuseHub-distributed plugins did in the recent past, when their license expired. Now this can happen only once per offending plugin (rather than every time): next time, it'll be marked as invalid. MSS will benefit from it without further work. Audacity will need to use the lock guard in its plugin-loading code.
4221255 to
5ac94f3
Compare
Resolves: audacity/audacity#11604
It can be that a once validated plugin later crashes the application, like MuseHub-distributed plugins did in the recent past, when their license expired.
With this PR, this can happen only once per offending plugin (rather than every time): next time, at startup, it'll be marked as invalid and won't be available in the app anymore.
MSS will benefit from this PR without further work.
Audacity will need to use the lock guard in its plugin-loading code - a small change, and not one needed for successful compilation.
Build configuration
audacity: audacity/audacity/master
audacity platforms: linux_x64
musescore: musescore/MuseScore/main
musescore platforms: linux_x64