git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] config: retry acquiring config.lock, configurable via core.configLockTimeout

From
Junio C Hamano <gitster@pobox.com>
Date
May 18, 2026, 00:46 UTC
Message-ID
<xmqqzf1xbl4i.fsf@gitster.g>
In-Reply-To
<20260517132111.1014901-1-joerg@thalheim.io>
Joerg Thalheim <joerg@thalheim.io> writes:
Show 17 quoted lines
> +/*
> + * How long to retry acquiring config.lock when another process holds
> + * it. Default matches core.packedRefsTimeout; override via
> + * core.configLockTimeout.
> + */
> +static long config_lock_timeout_ms(struct repository *r)
> +{
> +	static int configured;
> +	static int timeout_ms = 1000;
> +
> +	if (!configured) {
> +		repo_config_get_int(r, "core.configlocktimeout", &timeout_ms);
> +		configured = 1;
> +	}
> +
> +	return timeout_ms;
> +}

The above design means whichever repository happens to be passed for the first time as "r" to this call will fix the return value from the function for the rest of the system, meaning that the lock timeout is a per-process property and the repository parameter passed to the function does not matter all that much.

It may make sense to admit that this is not a per-repository property (due to the use of local caching), have the function take no parameter and use the_repository to the config_get call. That would make the intention more clear.

Of course the other end of the spectrum is to get rid of the "configured" caching here, and ask the config system to make a hashtable look-up every time the function is called. That will keep the lock timeout per-repository, which is closer to what the current function signature suggests.

I dunno. My gut feeling is that there aren't valid reasons why you would want to specifically set different timeout values per repository, so the simplicity of using the_repository (i.e. the primary repository instance this process deals with) sounds like a better way to go.

Thanks.
Previous: Joerg ThalheimNext: Patrick Steinhardt
Message 10 of 18 in “config: retry acquiring config.lock for 100ms”
  1. config: retry acquiring config.lock for 100msJoerg Thalheim, Apr 3, 2026
  2. Junio C HamanoApr 3, 2026
  3. Patrick SteinhardtApr 8, 2026
  4. Junio C HamanoMay 11, 2026
  5. Patrick SteinhardtMay 11, 2026
  6. Jörg ThalheimMay 11, 2026
  7. Patrick SteinhardtMay 11, 2026
  8. Johannes SchindelinMay 17, 2026
  9. config: retry acquiring config.lock, configurable via core.configLockTimeoutJoerg Thalheim, May 17, 2026
  10. Junio C HamanoMay 18, 2026
  11. Patrick SteinhardtMay 18, 2026
  12. Johannes SchindelinJul 8, 2026
  13. Junio C HamanoJul 8, 2026
  14. Johannes SchindelinMay 28, 2026
  15. Junio C HamanoMay 28, 2026
  16. Johannes SchindelinJul 7, 2026
  17. Junio C HamanoJul 7, 2026
  18. Junio C HamanoJul 23, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.