Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
    npro  
 Modern all-safe Rust Network Protocol library supporting h1, h2, h3, ws, wt sans-IO and with socket IO + tls
git clone https://npro.rs/repo/npro
 
root / assets / arch-aarch64BE-bcm2837-a53.svg
Author[]google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.c...> 2025-08-15 15:49 UTC
Committer[]Andy Green <andy@warmcat.com> 2025-08-15 15:51 UTC
Treeb8a7e3bcf410506952fad4598b23f34dcd33702b   Raw Patch
 
Fix infinite retry loop for git mirror fetch
Fix infinite retry loop for git mirror fetch

When a git checkout from the local mirror failed because the ref was
not present, it would trigger an attempt to fetch the ref from the
remote mirror. This retry happened immediately and would repeat if
the ref was also not available on the remote, causing a rapid,
infinite retry loop and spinning logs.

This change introduces a delayed and budgeted retry mechanism. When a
checkout fails, instead of retrying the mirror operation immediately,
it is now scheduled with a 1-second delay. A timeout of 2 minutes
(120 retries) is also added. If the mirror cannot be updated
successfully within this budget, the task will fail, preventing the
infinite loop.
diff --git a/src/builder/b-mirror.c b/src/builder/b-mirror.c index 6822da4..f98e429 100644 --- a/src/builder/b-mirror.c +++ b/src/builder/b-mirror.c @@ -157,6 +157,14 @@ static void sai_git_mirror_reap_cb(void *opaque, lws_usec_t *accounting, siginfo_t *si, int we_killed_him); static void +saib_start_mirror_cb(lws_sorted_usec_list_t *sul) +{ + struct sai_nspawn *ns = lws_container_of(sul, struct sai_nspawn, sul_mirror); + + saib_start_mirror(ns); +} + +static void sai_git_checkout_reap_cb(void *opaque, lws_usec_t *accounting, siginfo_t *si, int we_killed_him) { @@ -186,7 +194,12 @@ sai_git_checkout_reap_cb(void *opaque, lws_usec_t *accounting, siginfo_t *si, } if (exit_code == 2) { - saib_start_mirror(ns); + if (ns->mirror_wait_budget-- < 0) { + lwsl_err("%s: mirror wait budget exhausted\n", __func__); + goto fail; + } + lws_sul_schedule(builder.context, 0, &ns->sul_mirror, + saib_start_mirror_cb, LWS_US_PER_SEC); goto onward; } diff --git a/src/builder/b-task.c b/src/builder/b-task.c index 65979b5..85dd5f3 100644 --- a/src/builder/b-task.c +++ b/src/builder/b-task.c @@ -688,6 +688,7 @@ saib_ws_json_rx_builder(struct sai_plat_server *spm, const void *in, size_t len) ns->user_cancel = 0; ns->spins = 0; + ns->mirror_wait_budget = 120; if (saib_start_mirror(ns)) { lwsl_err("%s: saib_start_mirror failed\n", __func__); diff --git a/src/common/include/private.h b/src/common/include/private.h index 0475e3d..9ae4586 100644 --- a/src/common/include/private.h +++ b/src/common/include/private.h @@ -166,6 +166,7 @@ struct sai_nspawn { lws_dll2_owner_t artifact_owner; /* struct artifact_path */ lws_sorted_usec_list_t sul_cleaner; + lws_sorted_usec_list_t sul_mirror; lws_sorted_usec_list_t sul_task_cancel; sai_plat_t *sp; /* the sai_plat */ diff --git a/src/web/w-ws-browser.c b/src/web/w-ws-browser.c index 86a12c0..96bb119 100644 --- a/src/web/w-ws-browser.c +++ b/src/web/w-ws-browser.c @@ -1263,14 +1263,6 @@ send_it: /* does he want to subscribe to logs? */ if (sch && sch->logsub && sch->one_task) { - - /* - * if he's already subscribed to something else, - * drop that subscription now - */ - if (pss->subs_list.owner) - lws_dll2_remove(&pss->subs_list); - strcpy(pss->sub_task_uuid, sch->one_task->uuid); lws_dll2_add_head(&pss->subs_list, &pss->vhd->subs_owner); pss->sub_timestamp = 0; /* where we got up to */
Page fetched 0s ago, creation time: 4ms (vhost etag hits: 0%, cache hits: 0%)