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

20 views
Skip to first unread message

Alexander Mazurov

unread,
Sep 26, 2025, 5:01:57 AMSep 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

Nasser Grainawi

unread,
Oct 1, 2025, 12:11:07 PMOct 1
to Alexander Mazurov, Repo and Gerrit Discussion
On Fri, Sep 26, 2025 at 3:01 AM Alexander Mazurov <alexande...@gmail.com> wrote:

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.

Can you point to which doc(s) you think is misleading? Your analysis below of the behavior looks accurate, so we probably need to update the docs, unless you'd like to help fix these methods to support reading a newer config.
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/repo-discuss/afff6dd3-2dae-4263-af73-45c598081827n%40googlegroups.com.

Alexander Mazurov

unread,
Oct 1, 2025, 1:18:11 PMOct 1
to Nasser Grainawi, Repo and Gerrit Discussion
Reply all
Reply to author
Forward
0 new messages