Gerrit 3.12 – PluginConfigFactory#getFromGerritConfig does not reload updated gerrit.config from disk

2 views
Skip to first unread message

Alexander Mazurov

unread,
Sep 26, 2025, 5:01:57 AM (yesterday) Sep 26
to Repo and Gerrit Discussion

Hi Gerrit Experts,

I’m working with Gerrit 3.12 and noticed an inconsistency between the documentation and the actual behavior of plugin configuration loading.

In my plugin, I use:

```

import com.google.gerrit.server.config.PluginConfigFactory;

PluginConfig cfg =
    pluginConfigFactory.getFromGerritConfig("pluginname", true);

```

According to the documentation on plugin configuration, this should read the plugin configuration from the updated $SITE/etc/gerrit.config on disk. However, in practice it only returns the original values loaded during Gerrit startup.

Debugging findings

  • The provider injected into PluginConfigFactory is CopyConfigModule, not GerritServerConfigProvider.
  • CopyConfigModule works on a static snapshot of the config and does not re-read from disk.
  • As a result, plugins cannot observe updates to gerrit.config unless Gerrit itself is restarted or an explicit reload mechanism is triggered.

This suggests that the documentation is misleading: PluginConfigFactory#getFromGerritConfig() does not read directly from disk.

Questions
  1. How can a plugin obtain updated global configuration (gerrit.config) from disk?
    • The only option I’ve identified is listening to the reload-config event (via a @Listen annotated ReloadConfigListener) and then re-fetching values. Is this the intended/official solution?
  2. Is the documentation outdated, or am I missing something?
    • PluginConfigFactory#getFromGerritConfig() relies on the provider bound in CopyConfigModule and no reading from the disk

Any clarification would be very helpful — especially whether there is an officially supported way for plugins to dynamically re-read gerrit.config, or whether relying on reload-config is the correct pattern.

Thank you,
Alexander

Reply all
Reply to author
Forward
0 new messages