Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snapshotter example fails with a protocol error #52

Closed
mythi opened this issue Mar 4, 2022 · 5 comments
Closed

snapshotter example fails with a protocol error #52

mythi opened this issue Mar 4, 2022 · 5 comments

Comments

@mythi
Copy link

mythi commented Mar 4, 2022

With ctr i pull --snapshotter custom docker.io/library/hello-world:latest given by the README, the snapshotter server returns a protocol error:

...
unpacking linux/amd64 sha256:97a379f4f88575512824f3b352bc03cd75e239179eea0fecc38e597b2209f49a...
ctr: failed to prepare extraction snapshot "extract-947546364-RurZ sha256:e07ee1baac5fae6a26f30cabfe54a36d3402f96afda318fe0a96cec4ca393359": stream terminated by RST_STREAM with error code: PROTOCOL_ERROR: unknown

A snippet from the snapshotter logs:

...
DEBUG [h2::codec::framed_read] received frame=Headers { stream_id: StreamId(1), flags: (0x4: END_HEADERS) }
TRACE [tracing::span::active] <- FramedRead::poll_next
TRACE [tracing::span] -- FramedRead::poll_next
TRACE [h2::proto::connection] recv HEADERS frame=Headers { stream_id: StreamId(1), flags: (0x4: END_HEADERS) }
TRACE [h2::proto::streams::flow_control] inc_window; sz=1048576; old=0; new=1048576
TRACE [h2::proto::streams::flow_control] inc_window; sz=65535; old=0; new=65535
TRACE [h2::proto::streams::streams] recv_headers; stream=StreamId(1); state=State { inner: Idle }
TRACE [h2::proto::streams::recv] opening stream; init_window=1048576
DEBUG [h2::server] malformed headers: malformed authority (b"unix:///tmp/snap2.sock"): invalid uri character
TRACE [h2::proto::streams::send] send_reset(..., reason=PROTOCOL_ERROR, initiator=Library, stream=StreamId(1), ..., is_reset=false; is_closed=false; pending_send.is_empty=true; state=State { inner: Open { local: 
AwaitingHeaders, remote: Streaming } } 
TRACE [h2::proto::streams::prioritize] clear_queue; stream.id=StreamId(1)
TRACE [tracing::span::active] -> clear_queue
TRACE [tracing::span::active] <- clear_queue
TRACE [tracing::span] -- clear_queue
...
@mxpv
Copy link
Member

mxpv commented Mar 5, 2022

The example from the snapshotter crate is not an actual snapshotter implementation. It's rather an example how to implement Snapshots trait and how to bootstrap snapshotter server.

@mythi
Copy link
Author

mythi commented Mar 7, 2022

I was aware of it but wasn't expecting an error like this. Perhaps the readme could add a line about the expected output.

@mythi
Copy link
Author

mythi commented Apr 6, 2022

I briefly looked into this yesterday again and I believe this depends on hyperium/h2#612. Some work was done in grpc-go (grpc/grpc-go#3730) but that does not seem to help.

@mythi
Copy link
Author

mythi commented Apr 7, 2022

@mxpv there seems to a small problem with containerd itself too. grpc-go handles the authority information

https://github.com/grpc/grpc-go/blob/5682cc6a321507ce2a865beb8dd4bed9a5db0e06/clientconn.go#L1654-L1665

but containerd does not pass the address in the expected format:

diff --git a/client.go b/client.go
index 1c2202e..dbe1252 100644
--- a/client.go
+++ b/client.go
@@ -142,7 +142,7 @@ func New(address string, opts ...ClientOpt) (*Client, error) {
                connector := func() (*grpc.ClientConn, error) {
                        ctx, cancel := context.WithTimeout(context.Background(), copts.timeout)
                        defer cancel()
-                       conn, err := grpc.DialContext(ctx, dialer.DialAddress(address), gopts...)
+                       conn, err := grpc.DialContext(ctx, address, gopts...)
                        if err != nil {
                                return nil, fmt.Errorf("failed to dial %q: %w", address, err)
                        }

(just tested with the example here and that worked. I could prepare a better patch to containerd after checking all cases are covered).

@mythi
Copy link
Author

mythi commented Apr 11, 2022

but containerd does not pass the address in the expected format:

quoting myself. this makes no sense. I've been using Debian Unstable's containerd 1.6.2 but it seems they build using an ancient grpc-go which does not have the authority improvements. A locally built containerd works just fine.

@mythi mythi closed this as completed Apr 11, 2022
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

No branches or pull requests

2 participants