RFR: 1512: MirrorBot may get stuck failing to clone repository

Erik Joelsson erikj at openjdk.org
Thu Sep 22 23:39:24 UTC 2022

On Tue, 13 Sep 2022 21:14:07 GMT, Zhao Song <duke at openjdk.org> wrote:

> Optimized the logic in MirrorBot.
> When MirrorBot tries to create a directory, the directory will have a 'temporary' suffix, then it will attempts cloning. It the cloning succeed, the suffix will be removed. If the clone fails or the bot happens to die, the directory will retain the suffix. On the next time, if we try to rerun the bot, the bot will detect the temporary directory and will delete the temporary directory first, therefore, the bot will not get stuck.

bots/mirror/src/main/java/org/openjdk/skara/bots/mirror/MirrorBot.java line 102:

> 100:             } else {
> 101:                 log.info("Found existing scratch directory for " + to.name());
> 102:                 repo = Repository.get(dir).orElseThrow(() -> {

Instead of introducing a temporary directory, I would recommend just falling back on recloning if `Repository::get` fails. Something like this:

                repo = Repository.get(dir).orElseGet(() -> {
                    try {
                    } catch (IOException e) {
                        throw new UncheckedIOException(e);
                    Repository.mirror(from.url(), dir);


PR: https://git.openjdk.org/skara/pull/1374

More information about the skara-dev mailing list