Skip to content

Commit

Permalink
gvfs-helper: don't fallback with new config
Browse files Browse the repository at this point in the history
By default, GVFS Protocol-enabled Scalar clones will fall back to the
origin server if there is a network issue with the cache servers.
However (and especially for the prefetch endpoint) this may be a very
expensive operation for the origin server, leading to the user being
throttled. This shows up later in cases such as 'git push' or other web
operations.

To avoid this, create a new config option, 'gvfs.fallback', which
defaults to true. When set to 'false', pass '--no-fallback' from the
gvfs-helper client to the child gvfs-helper server process.

This will allow users who have hit this problem to avoid it in the
future. In case this becomes a more widespread problem, engineering
systems can enable the config option more broadly.

Enabling the config will of course lead to immediate failures for users,
but at least that will help diagnose the problem when it occurs instead
of later when the throttling shows up and the server load has already
passed, damage done.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
  • Loading branch information
derrickstolee authored and mjcheetham committed Jul 29, 2024
1 parent 3e8a7c4 commit c5d5aba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Documentation/config/gvfs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ gvfs.cache-server::

gvfs.sharedcache::
TODO

gvfs.fallback::
If set to `false`, then never fallback to the origin server when the cache
server fails to connect. This will alert users to failures with the cache
server, but avoid causing throttling on the origin server.
11 changes: 10 additions & 1 deletion gvfs-helper-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "quote.h"
#include "packfile.h"
#include "hex.h"
#include "config.h"

static struct oidset gh_client__oidset_queued = OIDSET_INIT;
static unsigned long gh_client__oidset_count;
Expand Down Expand Up @@ -339,17 +340,25 @@ static struct gh_server__process *gh_client__find_long_running_process(
struct gh_server__process *entry;
struct strvec argv = STRVEC_INIT;
struct strbuf quoted = STRBUF_INIT;
int fallback;

gh_client__choose_odb();

/*
* TODO decide what defaults we want.
*/
strvec_push(&argv, "gvfs-helper");
strvec_push(&argv, "--fallback");
strvec_push(&argv, "--cache-server=trust");
strvec_pushf(&argv, "--shared-cache=%s",
gh_client__chosen_odb->path);

/* If gvfs.fallback=false, then don't add --fallback. */
if (!git_config_get_bool("gvfs.fallback", &fallback) &&
!fallback)
strvec_push(&argv, "--no-fallback");
else
strvec_push(&argv, "--fallback");

strvec_push(&argv, "server");

sq_quote_argv_pretty(&quoted, argv.v);
Expand Down

0 comments on commit c5d5aba

Please sign in to comment.