Skip to content

fix: fix load image failed#4888

Open
ningmingxiao wants to merge 1 commit into
containerd:mainfrom
ningmingxiao:fix_load
Open

fix: fix load image failed#4888
ningmingxiao wants to merge 1 commit into
containerd:mainfrom
ningmingxiao:fix_load

Conversation

@ningmingxiao
Copy link
Copy Markdown
Contributor

@ningmingxiao ningmingxiao commented May 7, 2026

fix test TestLoadStdinFromPipe failed

reproduce
add some sleep at https://github.com/containerd/nerdctl/blob/v2.3.0/pkg/imgutil/load/load.go#L93

		transfer.WithProgress(func(p transfer.Progress) {
			time.Sleep(time.Second * 3)
			if p.Event == "saved" {

nothing will out put

nerdctl  load -i pause.tar

@ChengyuZhu6 it's introduce by commit c40fda5
another reason containerd/containerd#13097
so we can't use identifier := data.Identifier() now until containerd fix it.

@ningmingxiao
Copy link
Copy Markdown
Contributor Author

ningmingxiao commented May 10, 2026

after many tests I find TestLoadStdinFromPipe still failed sometimes because of the tag size( it should be containerd bug? )
find "docker.io/library/testloadstdinfrompipet saved" maybe because tag is too long and sometimes ci will failed.

root@nmx-Swift-SF314-512:/home/nmx# nerdctl images
REPOSITORY                                                                         TAG       IMAGE ID        CREATED              PLATFORM       SIZE       BLOB SIZE
testloadstdinfrompipetestloadstdinfrompipe1111222222222222222222222222222222222    latest    82742949a370    About an hour ago    linux/amd64    4.411MB    2.153MB
root@nmx-Swift-SF314-512:/home/nmx# nerdctl save testloadstdinfrompipetestloadstdinfrompipe1111222222222222222222222222222222222:latest -o 1.tar
root@nmx-Swift-SF314-512:/home/nmx# nerdctl load -i 1.tar 
docker.io/library/testloadstdinfrompipet	saved	
application/vnd.oci.image.index.v1+json sha256:82742949a3709938cbeb9cec79f5eaf3e48b255389f2dcedf2de29ef96fd841c
Importing	elapsed: 0.2 s	total:   0.0 B	(0.0 B/s)	
Loaded image: docker.io/library/testloadstdinfrompipetestloadstdinfrompipe1111222222222222222222222222222222222:latest

and another err log is (with shot tag see ningmingxiao#14 ci logs)

2026-05-10T13:41:43.8249721Z         +------------------------------------------------------------------------------------------------------------+
2026-05-10T13:41:43.8250231Z         | ➡️      | ⚙️ /usr/local/bin/nerdctl load                                                                   |
2026-05-10T13:41:43.8250586Z         +------------------------------------------------------------------------------------------------------------+
2026-05-10T13:41:43.8251099Z         |         | 🚫 command returned a non-zero exit code                                                         |
2026-05-10T13:41:43.8251469Z         +------------------------------------------------------------------------------------------------------------+
2026-05-10T13:41:43.8251887Z         |         | ⚠️ 1                                                                                             |
2026-05-10T13:41:43.8252278Z         +------------------------------------------------------------------------------------------------------------+
2026-05-10T13:41:43.8252872Z         |         | 🟠 time="2026-05-10T13:41:41Z" level=fatal msg="failed to ingest \"blobs/sha256/ec14c7992a97fc11 |
2026-05-10T13:41:43.8253391Z         |         | 425907e908340c6c3d6ff602f5f13d899e6b7027c9b4133a\": short read: expected 1638 bytes but got 0: u |
2026-05-10T13:41:43.8253719Z         |         | nexpected EOF"                                                                                   |
2026-05-10T13:41:43.8254096Z         +------------------------------------------------------------------------------------------------------------+
2026-05-10T13:41:43.8254555Z         | 🌱      | HOME=/root                                                                                       |
2026-05-10T13:41:43.8255029Z         |         | PATH=/usr/local/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin |
2026-05-10T13:41:43.8255301Z         |         | :/bin                                                                                            |
2026-05-10T13:41:43.8255792Z         |         | NERDCTL_TOML=/tmp/TestLoadStdinFromPipe325679214/264/nerdctl.toml                                |
2026-05-10T13:41:43.8256273Z         |         | DOCKER_CONFIG=/tmp/TestLoadStdinFromPipe325679214/264                                            |
2026-05-10T13:41:43.8256639Z         +------------------------------------------------------------------------------------------------------------+
2026-05-10T13:41:43.8257110Z         | ⏰      | <1s (limit: 3m0s)                                                                                |
2026-05-10T13:41:43.8257632Z         +------------------------------------------------------------------------------------------------------------+
2026-05-10T13:41:43.8258353Z         | 📁      | /tmp/TestLoadStdinFromPipe325679214/263  

@ningmingxiao ningmingxiao force-pushed the fix_load branch 3 times, most recently from 40c9f0d to 703400e Compare May 11, 2026 04:47
@AkihiroSuda
Copy link
Copy Markdown
Member

after many tests I find TestLoadStdinFromPipe still failed sometimes because of the tag size

Isn't the tag length deterministic?

@ningmingxiao
Copy link
Copy Markdown
Contributor Author

now tag length will not generate error now but find anoter error after many times test

2026-05-11T05:09:48.2118290Z         | ➡️      | ⚙️ /usr/local/bin/nerdctl load                                                                   |
2026-05-11T05:09:48.2118571Z         +------------------------------------------------------------------------------------------------------------+
2026-05-11T05:09:48.2118945Z         |         | 🚫 command returned a non-zero exit code                                                         |
2026-05-11T05:09:48.2119156Z         +------------------------------------------------------------------------------------------------------------+
2026-05-11T05:09:48.2119382Z         |         | ⚠️ 1                                                                                             |
2026-05-11T05:09:48.2119597Z         +------------------------------------------------------------------------------------------------------------+
2026-05-11T05:09:48.2119944Z         |         | 🟠 time="2026-05-11T05:09:43Z" level=fatal msg="untar oci layout \"oci-layout\": unexpected EOF" |
2026-05-11T05:09:48.2120096Z         |         |                                                                                                  |
2026-05-11T05:09:48.2120311Z         +------------------------------------------------------------------------------------------------------------+
2026-05-11T05:09:48.2120583Z         | 🌱      | XDG_SESSION_TYPE=tty                                                                             |
2026-05-11T05:09:48.2120770Z         |         | HOME=/home/rootless                                                                              |
2026-05-11T05:09:48.2120968Z         |         | XDG_SESSION_CLASS=user                                                                           |
2026-05-11T05:09:48.2121145Z         |         | XDG_SESSION_ID=3                                                                                 |
2026-05-11T05:09:48.2121344Z         |         | XDG_RUNTIME_DIR=/run/user/1000                                                                   |
2026-05-11T05:09:48.2121617Z         |         | PATH=/usr/local/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin |
2026-05-11T05:09:48.2121838Z         |         | :/bin:/usr/games:/usr/local/games:/snap/bin                                                      |
2026-05-11T05:09:48.2122120Z         |         | NERDCTL_TOML=/tmp/TestLoadStdinFromPipe161586707/279/nerdctl.toml                                |
2026-05-11T05:09:48.2122392Z         |         | DOCKER_CONFIG=/tmp/TestLoadStdinFromPipe161586707/279                                            |
2026-05-11T05:09:48.2122598Z         +------------------------------------------------------------------------------------------------------------+
2026-05-11T05:09:48.2122858Z         | ⏰      | <1s (limit: 3m0s)                                                                                |
2026-05-11T05:09:48.2123069Z         +------------------------------------------------------------------------------------------------------------+
2026-05-11T05:09:48.2123471Z         | 📁      | /tmp/TestLoadStdinFromPipe161586707/278   

@ningmingxiao ningmingxiao force-pushed the fix_load branch 2 times, most recently from 65de54a to dc3acf6 Compare May 12, 2026 11:29
return progressFn, done
}

func ProgressHandlerLoadImage(ctx context.Context, client *containerd.Client, beforeSet map[string]bool, options types.ImageLoadOptions) (transfer.ProgressFunc, func(), *[]images.Image) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When client.Transfer finishes, it triggers cancel(), immediately killing the ProgressHandlerLoadImage goroutine. Any delayed saved events will still be dropped?

Comment thread pkg/imgutil/load/load.go

var loadedImages []images.Image
pf, done := transferutil.ProgressHandler(ctx, options.Stdout)
storeOpts = append(storeOpts, transferimage.WithNamedPrefix(fmt.Sprintf("import-%s", time.Now().Format("2006-01-02")), true))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It fixes the dash-to-space bug, but untagged archives will now print internal names to users?

Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
@AkihiroSuda AkihiroSuda added this to the v2.3.1 milestone May 14, 2026
@AkihiroSuda AkihiroSuda requested a review from ChengyuZhu6 May 14, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants