Repository navigation
Description
Location
libobs/obs-module.c.h, obs_load_core_modules (536-551) and load_all_callback (467-477):
bool obs_load_core_modules(void)
{
if (obs->core_modules_loaded) {
return true;
}
...
obs->core_modules_loaded = error.fail_count == 0; obs_module_t *existing_module = obs_get_module(info->name);
if (info->type != OBS_MODULE_TYPE_CORE && existing_module != NULL) {
/* "Skipping plugin ... already loaded from ..." */
return;
}Also obs_open_module (129-145): after os_dlopen succeeds, the missing-exports return and the newer-libobs return leave without os_dlclose.
Class
Logic error (duplicate module load).
How it is reached
obs_load_core_modules caches only success: core_modules_loaded is true only when no failure was counted. A failure is counted when a core module was built for a newer libobs or obs_open_module returns MODULE_ERROR. A second call then walks the core module list again, and load_all_callback skips a module that is already loaded only when it is not a core module. So every core module that did load is opened again: a second obs_module goes onto obs->first_module, obs_module_set_pointer is called again, and obs_module_load runs a second time, registering the module's source, output and encoder types again.
The bundled frontend calls obs_load_core_modules once and stops on failure, so it is reached by a frontend or tool that retries the call through the public API. No upstream issue.
The missing os_dlclose in obs_open_module matches free_module, which has not closed module libraries since upstream obs-studio commit 2446f62 ("Do not call dlclose on modules", 2014): unloading a library whose constructors registered something can crash later. That one is deliberate and only gets a comment saying so.
Proposed fix and failing test
- In
load_all_callback, skip a core module that is already loaded (with a debug log), as plugins are. Leave the success-only cache as it is, so a retry still reports the failure. - In
obs_open_module, comment that the two early returns leave the library loaded on purpose, asfree_moduledoes.
Test (RED first): a new case in test/cmocka/test_core_module_load.c. The child lays out the stub core modules with the first one built for a newer libobs, calls obs_load_core_modules twice and reports how many entries each core module has in the loaded module list. Both calls return false; today every other core module has two entries after the second call, and after the fix exactly one.
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Oct 28, 2026
Claiming: libobs: stop
obs_load_core_modulesreloading already-loaded core modules (#2730)Plan (one PR,
fix/2730-core-module-reload):test/cmocka/test_core_module_load.c— the child callsobs_load_core_modules()twice against stub core modules where the first is built for a newer libobs, and reports how many entries each core module has in the loaded list. Both calls return false; today the other core modules have two entries after the second call.load_all_callback, skip a core module that is already inobs_get_module(), with a debug log, as plugins are skipped. Keep the success-only cache so a retry still reports the failure.obs_open_modulethat the two early returns leave the library loaded on purpose (matchingfree_module, upstream 2446f62); noos_dlclose.test_core_module_loadin the Tier 2 build volume, open the PR with the RED/GREEN evidence,Fixes #2730.libobs: skip a core module that is already loaded
zackees commentedon Oct 28, 2026
Fixed in #2732 (merged as
01279b76bqueue entry; squash-merged).What landed:
load_all_callbacknow skips a core module that is already in the module list (with the same debug log the plugin branch uses), so a secondobs_load_core_modulesafter a failed call no longer registers every already-loaded core module's source/output/encoder types again; the success-onlycore_modules_loadedcache is unchanged, so a retry still reports the failure.obs_open_module's two early returns keep the library loaded on purpose, with a comment saying so (same policy asfree_modulesince upstream 2446f62).Evidence: the new
test/cmocka/test_core_module_load.ccase (a_failed_load_does_not_reload_the_core_modules_that_did_load) RED ond502777eband GREEN ondf6b3abfb; the Linux Tier 2 lane, Flatpak-adjacent lanes, Format andCI Gate ✅all passed on the branch.Nothing is left on this issue; the
obs_dlcloseobservation was documentation-only by design.libobs: stop obs_load_core_modules reloading already loaded core modu…