Repository navigation
libobs: stop obs_load_core_modules reloading already loaded core modules (#2730) - #2732
Merged
Merged
Conversation
Observed output of the new case on this commit: [ RUN ] retry_after_failure core module 'decklink-captions' has 2 entries in the loaded list, want 1 [ FAILED ] retry_after_failure obs_load_core_modules() caches only success, so a caller that retries after a failure walks the core module list again, and load_all_callback() skips an already loaded module only when it is not a core module: every core module that did load is opened a second time and obs_module_load() runs twice. Refs #2730.
obs_load_core_modules() caches only success, so a caller that retries after a failure walks the core module list again. load_all_callback() skipped an already loaded module only when it was not a core module, so every core module that did load was opened again, a second obs_module entry went onto obs->first_module and obs_module_load() ran a second time, registering the module's types again. Skip a core module that obs_get_module() already returns, with a debug log, as plugins are skipped. The success-only cache stays, so a retry still reports the failure. The two early returns in obs_open_module() also get the comment saying the library is left loaded on purpose, which is what free_module() has done since upstream 2446f62 ("Do not call dlclose on modules", 2014). GREEN of test/cmocka/test_core_module_load.c's retry_after_failure: 26/26 pass. Fixes #2730.
zackees
marked this pull request as draft
October 28, 2026 05:13
zackees
marked this pull request as ready for review
October 28, 2026 06:17
Member
Author
|
Handed off to the coordinator. CI is green (CI Gate ✅) and mergeStateStatus is CLEAN on |
Member
Author
|
Handed off to the coordinator. State on handoff: rebased on Queued: position 1, state QUEUED. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
obs_load_core_modules()caches only success (core_modules_loaded = error.fail_count == 0), so a caller that retries after a failed call walks the core module list again.load_all_callback()skipped an already loaded module only when it was not a core module (info->type != OBS_MODULE_TYPE_CORE && existing_module != NULL), so every core module that did load was opened a second time: a secondobs_modulewent ontoobs->first_module,obs_module_set_pointer()ran again, andobs_module_load()ran again, registering the module's source/output/encoder types a second time.The fix skips a core module that
obs_get_module()already returns, with a debug log, as plugins are skipped. The success-only cache stays, so a retry still reports the failure. The two early returns inobs_open_module()(missing exports, newer libobs) also get the comment saying the library is left loaded on purpose, matchingfree_module()since upstream 2446f62 ("Do not call dlclose on modules", 2014); noos_dlcloseis added.RED — d502777 (
test(libobs): a failed core module load must not reload the others)New case
retry_after_failureintest/cmocka/test_core_module_load.c. A new stubcore_module_stub_newer.creportsLIBOBS_API_VER + 0x00010000, so the first core module in the list fails as one built for a newer libobs. The child callsobs_load_core_modules()twice and counts each core module's entries in the loaded module list.Observed on d502777:
Both calls return false (the failure is still reported); the other core modules have two entries after the second call.
GREEN — df6b3ab (
libobs: skip a core module that is already loaded)Built and run in the repo's Tier 2 Docker image (
obs-rust-linux-validate:1c93fce56a25553c) underxvfb-run -a, against the Tier 2 build volume.clang-format --dry-run --Werrorandgersemi -care clean. The feature behavior is documented indocs/features.md.Tiers
test_core_module_load, 26/26 pass, including the new case. The other 25 cases (all_present,missing_dependency,missing_file,same_libobs, module search paths, names and type lists) are unchanged and pass.libobs-c-reference; this is a duplicate-load guard in module bookkeeping.No existing C test or public header is edited; the new test case and stub are added.
Fixes #2730