Skip to content

Fix #9214: Avoid bogus "NoDefault" plugin load on every attach and unnecessary loadModuleMutex locks - #9224

Open
mariuz wants to merge 1 commit into
FirebirdSQL:masterfrom
mariuz:fix-9214-client-crypt-no-default-plugin
Open

mariuz wants to merge 1 commit into
FirebirdSQL:masterfrom
mariuz:fix-9214-client-crypt-no-default-plugin

Conversation

@mariuz

@mariuz mariuz commented Oct 20, 2026

Copy link
Copy Markdown
Member

Fixes #9214

Cause

  1. In ClntAuthBlock::ClientCrypt (src/remote/remote.h), the constructor initialized GetPlugins<IKeyHolderPlugin> with "NoDefault" (introduced in 0453bbec9e / CORE-6220 as a placeholder before ClientCrypt::create() later calls pluginItr.set(conf)). Because GetPlugins only treats nullptr specially, "NoDefault" was passed directly to PluginSet as a literal plugin name. On every ClntAuthBlock construction (every attach), PluginSet::next() attempted to load plugins/NoDefault via ModuleLoader::loadModule (LoadLibraryEx / dlopen) while holding loadModuleMutex, right before pluginItr.set(clntConfig) replaced the iterator with the configured KeyHolderPlugin (which defaults to "").
  2. In PluginSet::next() (src/yvalve/PluginManager.cpp), loadModuleMutex and plugins->mutex were acquired unconditionally before checking if namesList had any words or if the plugin was already present in the configured plugins map.

Fix

  1. Pass "" (empty plugin list) instead of "NoDefault" in ClntAuthBlock::ClientCrypt::ClientCrypt().
  2. In PluginSet::next(), iterate currentName.getWord(namesList, " \t,;") first (so an empty namesList does not acquire any mutex) and check plugins->get(...) under plugins->mutex before acquiring loadModuleMutex for the slow module-loading path.

…tach and unnecessary loadModuleMutex locks

1. In ClntAuthBlock::ClientCrypt (src/remote/remote.h), pass "" instead of
   "NoDefault" to GetPlugins<IKeyHolderPlugin>. GetPlugins does not treat
   "NoDefault" specially, so PluginSet treated it as a literal plugin name
   and attempted to LoadLibrary/dlopen "plugins/NoDefault" while holding
   loadModuleMutex on every attach before ClientCrypt::create() replaced
   the iterator with the configured KeyHolderPlugin.

2. In PluginSet::next() (src/yvalve/PluginManager.cpp), only acquire
   loadModuleMutex when a plugin is not already present in the configured
   plugins map, and avoid acquiring any mutex when namesList is empty.
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.

Firebird Client Deadlock

1 participant