CI build often fails by timeout for my app: failed to clone gir-files

I hope this forum is the right place for this kind of post. Please, let me know if it’s not.

My app was recently accepted to Flathub, but the CI build failed from initial PR, then succeeded form the second attempt, and then failed again after acceptance from exactly the same commit. I retried 2 more times after that, and it was stuck with the same issue (so I still can’t get it published on flathub.org).

The issue seems to be with downloading dependencies for gtk-rs:

Cloning into '/srv/buildbot/worker/build-x86_64-7/build/.flatpak-builder/build/watchmate-1/flatpak-cargo/git/gtk4-rs-6b7f5d5/gir-files'...
fatal: did not receive expected object 3c426d639f8b5dbe3066b8a94becb1bfe5f4874e
fatal: fetch-pack: invalid index-pack output
fatal: clone of 'file:///srv/buildbot/worker/build-x86_64-7/build/.flatpak-builder/git/https_github.com_gtk-rs_gir-files.git' into submodule path '/srv/buildbot/worker/build-x86_64-7/build/.flatpak-builder/build/watchmate-1/flatpak-cargo/git/gtk4-rs-6b7f5d5/gir-files' failed
Failed to clone 'gir-files'. Retry scheduled
Cloning into '/srv/buildbot/worker/build-x86_64-7/build/.flatpak-builder/build/watchmate-1/flatpak-cargo/git/gtk4-rs-6b7f5d5/gir-files'...
fatal: did not receive expected object 3c426d639f8b5dbe3066b8a94becb1bfe5f4874e
fatal: fetch-pack: invalid index-pack output
fatal: clone of 'file:///srv/buildbot/worker/build-x86_64-7/build/.flatpak-builder/git/https_github.com_gtk-rs_gir-files.git' into submodule path '/srv/buildbot/worker/build-x86_64-7/build/.flatpak-builder/build/watchmate-1/flatpak-cargo/git/gtk4-rs-6b7f5d5/gir-files' failed
Failed to clone 'gir-files' a second time, aborting

But I can never reproduce this issue locally, and the CI succeeded occasionally (sometimes for just one arch, so overall the build fails). Does anybody have a clue what could be the reason here or what can I do to improve the situation?

Here’s the publish PR for full context.

if commit for the submodule is old, you might try “disable-shallow-clone”

1 Like

Oh, thanks a lot! I was completely out of ideas. I enabled disable-shallow-clone for gtk-rs in generated cargo-sources.json, and now the downloading step passes successfully!

Overall the build still failed, now at uploading build outputs (for aarch64). I scheduled a retry for now, will worry about it and dig deeper later if it fails again.

Just curious, how does this disable-shallow-clone work? Does it clone the repo with submodules as if it was a single repo, instead of cloning a top-level repo first and then cloning submodules? I wonder why it helped.

By default the builders use shallow clone to not pull a large amount of data on big repo. But sometime submodules refer to an object that shallow clone didn’t fetch.

Shallow clone a “standard” feature for git clone Git - git-clone Documentation

And on your local machine flatpak-builder doesn’t do it.

As for the upload failure, usually retriggering is enough.

Thank you for the detailed explanation. Yeah, retry helped with uploading error. Yay!