container icon indicating copy to clipboard operation
container copied to clipboard

[Bug]: Retry on network errors before giving up

Open dkovba opened this issue 2 months ago • 3 comments

I have done the following

  • [x] I have searched the existing issues
  • [x] If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

  1. Pull a large ~30 GB image (an exact link isn't disclosed).

Problem description

This fails with:

Error: StreamClosed(streamID: HTTP2StreamID(45), errorCode: HTTP2ErrorCode<0x1 ProtocolError>, location: "NIOHTTP2/HTTP2StreamChannel.swift:892")

Or just:

Error: HTTPClientError.remoteConnectionClosed

Environment

- OS: macOS
- Container: commit 6e65319

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

dkovba avatar Sep 12 '26 00:09 dkovba

Hi @dkovba, I looked into this. The pull fails because containerization only retries when the connection fails before the server responds. If the connection drops while a layer is downloading, the error goes straight up and the pull stops.

I have a fix: when the download drops, ask for the rest of the layer with a Range header and continue where it left off, using the existing retry settings. If the registry doesn't support ranges, it starts the layer over. I tested it with a local server that cuts the connection mid-download.

Does this sound okay? If yes, I'll open the PR in containerization.

nandan-varma avatar Oct 06 '26 01:10 nandan-varma

Opened apple/containerization#949 for this.

nandan-varma avatar Oct 07 '26 05:10 nandan-varma

Related: apple/containerization#1035. When a pull fails, the layers that already finished are deleted along with the ingest session, so the retry downloads them again. apple/containerization#949 resumes the layer in flight, but the finished ones are still lost if the pull ends up failing.

VictorPuga avatar Nov 29 '26 16:11 VictorPuga