setup-buildx-action icon indicating copy to clipboard operation
setup-buildx-action copied to clipboard

FIX: Add retry mechanism with exponential backoff for buildkit bootstrap step

Open danielamar101-pton opened this issue 7 months ago • 2 comments

This should fix: https://github.com/docker/setup-buildx-action/issues/283

There is a race condition in the buildx setup process:

  • When the action runs docker buildx inspect --bootstrap --builder , it's trying to initialize the buildkit daemon.
  • The error occurs because the action is trying to communicate with buildkit via its socket file (/run/buildkit/buildkitd.sock) before the daemon is fully initialized.

The fix here is to continue retrying until the daemon is fully initialized, and timing the bootstrap out after 15 seconds to attempt a retry, instead of waiting many minutes.

Try and replace docker/setup-buildx-action@v3 with: danielamar101-pton/setup-buildx-action@fix-buildx-bootstrap-race-condition to use my version, and notice a reduction in waiting for this action.

danielamar101-pton avatar May 05 '25 20:05 danielamar101-pton

@crazy-max thoughts here? We used the fix here and noticed a considerable reduction in time waiting for this action, when it displays this intermittent race condition.

danielamar101-pton avatar May 06 '25 12:05 danielamar101-pton

@crazy-max implemented the change to retry for any error instead of just buildx errors, as well as reduced the max retry attempts. Your final request warrants further discussion.

danielamar101-pton avatar May 27 '25 17:05 danielamar101-pton