Skip to content

Commit 6bcaab8

Browse files
authored
gvfs-helper: show network advice for transient service errors (#880)
When gvfs_advice_on_retry() fires after exhausting retries, it unconditionally suggests checking disk space or deleting the shared object cache. This is misleading when the failures are transient network or service errors (e.g. CURLE_RECV_ERROR, HTTP 429, HTTP 503) rather than local filesystem problems like index-pack failures. The current advice (delete your scalar cache and retry) can be even worse under a service outage, such as recently occurred when the India region's cache servers were unable to respond to incoming requests. The users who followed this advice were not able to redownload data and were stuck without an ability to work. Teach gvfs_advice_on_retry() to distinguish between network/service errors and local errors by inspecting the error code. When the error is a curl error, HTTP 429, or HTTP 503, advise the user about potential service outages or network connectivity issues instead. The existing disk/cache advice is preserved for local failures such as index-pack errors (GH__ERROR_CODE__INDEX_PACK_FAILED). * [X] This change only applies to interactions with Azure DevOps and the GVFS Protocol.
2 parents 9e07d58 + 3fe3bcf commit 6bcaab8

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

gvfs-helper.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,15 @@ enum gh__error_code {
328328
GH__ERROR_CODE__HTTP_503 = 6,
329329
GH__ERROR_CODE__HTTP_OTHER = 7,
330330
GH__ERROR_CODE__UNEXPECTED_CONTENT_TYPE = 8,
331-
GH__ERROR_CODE__COULD_NOT_CREATE_TEMPFILE = 8,
332-
GH__ERROR_CODE__COULD_NOT_INSTALL_LOOSE = 10,
333-
GH__ERROR_CODE__COULD_NOT_INSTALL_PACKFILE = 11,
334-
GH__ERROR_CODE__SUBPROCESS_SYNTAX = 12,
335-
GH__ERROR_CODE__INDEX_PACK_FAILED = 13,
336-
GH__ERROR_CODE__COULD_NOT_INSTALL_PREFETCH = 14,
331+
332+
GH__ERROR_CODE__HTTP_ERROR_LIMIT = 9,
333+
334+
GH__ERROR_CODE__COULD_NOT_CREATE_TEMPFILE = 10,
335+
GH__ERROR_CODE__COULD_NOT_INSTALL_LOOSE = 11,
336+
GH__ERROR_CODE__COULD_NOT_INSTALL_PACKFILE = 12,
337+
GH__ERROR_CODE__SUBPROCESS_SYNTAX = 13,
338+
GH__ERROR_CODE__INDEX_PACK_FAILED = 14,
339+
GH__ERROR_CODE__COULD_NOT_INSTALL_PREFETCH = 15,
337340
};
338341

339342
enum gh__cache_server_mode {
@@ -3142,14 +3145,23 @@ static int compute_transient_delay(int attempt)
31423145
return v;
31433146
}
31443147

3145-
static void gvfs_advice_on_retry(void)
3148+
static void gvfs_advice_on_retry(enum gh__error_code ec)
31463149
{
31473150
static int advice_given = 0;
31483151

31493152
if (advice_given)
31503153
return;
31513154
advice_given = 1;
31523155

3156+
if (ec < GH__ERROR_CODE__HTTP_ERROR_LIMIT) {
3157+
advise_if_enabled(ADVICE_GVFS_HELPER_TRANSIENT_RETRY,
3158+
"GVFS Protocol network requests are failing. This is\n"
3159+
"likely caused by a service outage or unstable network\n"
3160+
"connection. Check your local network or contact your\n"
3161+
"engineering systems team for assistance.");
3162+
return;
3163+
}
3164+
31533165
if (gvfs_shared_cache_pathname.len) {
31543166
advise_if_enabled(ADVICE_GVFS_HELPER_TRANSIENT_RETRY,
31553167
"These retries may hint towards issues with your disk or\n"
@@ -3213,7 +3225,7 @@ static void do_req__with_robust_retry(const char *url_base,
32133225
/*
32143226
* Give advice for common reasons this could happen:
32153227
*/
3216-
gvfs_advice_on_retry();
3228+
gvfs_advice_on_retry(status->ec);
32173229
params->k_transient_delay_sec =
32183230
compute_transient_delay(params->k_attempt);
32193231
continue;

0 commit comments

Comments
 (0)