Skip to content

populateSubmodules runs a multi-minute population under the 60s transfer deadline, and the retry collides with the killed attempt's residue #280

Open

Description

@aitrawog

The defect

populateSubmodules (refs/git.go) wraps git submodule update --init --depth 1 in
runGitOp(transfer=true, …), which gives it gitOpTransferTimeout = 60s and up to
gitOpRetries = 2 retries. A population is not a 60-second operation for a large repo.

Measured cold (CHARLY_REPO_CACHE emptied, opencharly/opencharly:v2026.296.2037, 412
declared gitlinks): a fresh git clone --depth 1 followed by
git submodule update --init --depth 1 was still running at 4m04s (ps -eo etime,cmd
→ 04:04 git submodule--helper update -q --init --depth=1 --), so the op cannot complete
inside its own deadline on a cold cache on any ordinary link.

The retry then starts a SECOND git submodule update over the tree the killed attempt
left half-populated, and the residue turns into a hard failure. Two measured instances,
both from the pre-fix charly marketplace generate (rc=1):

# 1 — a lock left by the killed attempt
charly marketplace: collect entities: resolve @github.com/opencharly/opencharly:v2026.296.2037:
  downloading github.com/opencharly/opencharly:v2026.296.2037: populating submodules in
  /home/atrawog/.cache/charly/prefix279c/github.com/opencharly/[email protected]: exit status 128
fatal: Unable to create '.../.git/modules/charly/shallow.lock': File exists.

Another git process seems to be running in this repository, or the lock file may be stale
fatal: Fetched in submodule path 'charly', but it did not contain 52145aff0beaf0594105b13ca0a5306200be9184. Direct fetching of that commit failed.
generate rc=1

# 2 — a half-created work tree
fatal: destination path '.../plugin-user' already exists and is not an empty directory.
fatal: clone of 'https://github.com/opencharly/plugin-user.git' into submodule path '.../plugin-user' failed
Failed to clone 'plugin-user'. Retry scheduled
fatal: gitfile does not point to a valid repository: '.../pod-qemu-guest-agent/.git'
BUG: submodule considered for cloning, doesn't need cloning any more?
generate rc=1

A third cold attempt in the same environment succeeded end-to-end in 3m17s, which is
the same race landing benignly (an attempt re-walks and skips the submodules an earlier
attempt already completed).

Why this is a separate finding, not spec#279

Every one of the 412 submodules was reachable from this host: the git-level population
(no deadline) completed all 412. So this failure is not "an unreachable submodule fails
the fetch" (that is spec#279) — it is the 60s bound colliding with a multi-minute
operation, plus a retry that cannot recover from its own predecessor's residue.

opencharly/spec#279's files-only fetch (refs.DownloadRepoFiles) takes the corpus-source
caller off this path entirely. The --repo caller still populates, so
charly --repo opencharly/opencharly:<tag> on a cold cache remains a coin flip.

Ask

Any one of these closes it; the first is the smallest:

  1. give the population its own transfer bound instead of sharing the 60s clone bound
    (e.g. a populate bound scaled to the gitlink count, or no deadline for a
    non-network-latency operation that git itself already bounds per submodule);
  2. clear a previous attempt's residue before retrying (the sibling *.download dir is
    already removed by the caller on failure, so the residue here is only WITHIN one
    runGitOp retry loop);
  3. make the population resumable per submodule and treat "already populated" as success.

Filed from the session that landed spec#279; non-blocking for that change.

Agent: charly-spec279

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

Activity

  1. added
    category:delivery
    type:fix
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:deliverytype:fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions