Azure / Azure/azure-dev

ACR log replacement aborts successful remote builds with HTTP 416

Closed
#9,956 0 comments 0 reactions 1 assignee Claimed by @jongio View on GitHub
bug
Dominant language
Go
Stars
569
Forks
364
Avg merge
2d 19h
Merged PRs (30d)
136

Description

### Description

`azd deploy` can abort a successful ACR remote build with `HTTP 416 InvalidRange` when the build restarts and replaces its log blob. This was observed with azd 1.31.2 and 1.34.0; the affected ACR runs subsequently reported `Succeeded`.

`streamLogs` retains its byte cursor when the blob shrinks. A request beyond the replacement blob's end fails, and the error escapes before azd checks the run's terminal status.

### Reproduction

The failure can be reproduced deterministically through the Blob SDK transport:

1. Return a 12-byte log from HEAD and serve bytes 0 through 11.
2. Replace the log and return a content length of 4 from the next HEAD.
3. The current reader requests `bytes=12-` instead of restarting at byte 0.
4. Azure Blob Storage returns HTTP 416 and publishing aborts.

Replacement between HEAD and GET also produces a range or ETag race. A deleted log can reappear larger than the old cursor, so a not-found response must invalidate that cursor too.

### Expected behavior

Recover from log replacement using bounded, cancellable polling and fresh blob metadata. Preserve normal append behavior and genuine authorization, transport, writer, and build-status failures.

### Related work

Azure/azure-dev#9749 and Azure/azure-dev#9939 address the separate local-fallback failure. They do not repair log truncation or range recovery.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.