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

does not work with Windows namedpipe as proxy #1

Open
azyshalom opened this issue Aug 13, 2023 · 4 comments
Open

does not work with Windows namedpipe as proxy #1

azyshalom opened this issue Aug 13, 2023 · 4 comments

Comments

@azyshalom
Copy link

azyshalom commented Aug 13, 2023

using csi-grpc-proxy-v0.5.2-windows-amd64.exe from
https://github.com/democratic-csi/csi-grpc-proxy/releases/download/v0.5.2/csi-grpc-proxy-v0.5.2-windows-amd64.exe

it looks like the issue is in http2 code that add :80 suffix
_2023/08/13 06:09:52 http2: Transport failed to get client conn for localhost:80: The pipe has been ended.

which comes from:
https://github.com/golang/net/blob/c8c0290b421c479315f66c7b68b617ef6e73c668/http2/transport.go#L560

where a few line before, function authorityAddr return address + port:
https://github.com/golang/net/blob/c8c0290b421c479315f66c7b68b617ef6e73c668/http2/transport.go#L519

output:

C:>set REWRITE_HOST=1
C:>set REWRITE_HOST_HOSTNAME=localhost
C:>set BIND_TO=tcp://localhost:3381
C:>set PROXY_TO=npipe:////./pipe/containerd-containerd

C:>csi-grpc-proxy-v0.5.2-windows-amd64.exe
2023/08/13 06:07:44 BIND_TO [tcp://localhost:3381], PROXY_TO [npipe:////./pipe/containerd-containerd]
2023/08/13 06:07:44 PROXY_TO [npipe:////./pipe/containerd-containerd] is ready!
2023/08/13 06:07:44 BIND_TO [tcp://localhost:3381] is ready!
2023/08/13 06:07:52 h2c: attempting h2c with prior knowledge.
2023/08/13 06:07:52 http2: server connection from 127.0.0.1:59315 on 0xc0001321c0
2023/08/13 06:07:52 http2: Framer 0xc0001322a0: wrote SETTINGS len=24, settings: MAX_FRAME_SIZE=1048576, MAX_CONCURRENT_STREAMS=250, MAX_HEADER_LIST_SIZE=1048896, INITIAL_WINDOW_SIZE=1048576
2023/08/13 06:07:52 http2: server: client 127.0.0.1:59315 said hello
2023/08/13 06:07:52 http2: Framer 0xc0001322a0: wrote WINDOW_UPDATE len=4 (conn) incr=983041
2023/08/13 06:07:52 http2: Framer 0xc0001322a0: read SETTINGS len=0
2023/08/13 06:07:52 http2: server read frame SETTINGS len=0
2023/08/13 06:07:52 http2: Framer 0xc0001322a0: wrote SETTINGS flags=ACK len=0
2023/08/13 06:07:52 http2: Framer 0xc0001322a0: read SETTINGS flags=ACK len=0
2023/08/13 06:07:52 http2: server read frame SETTINGS flags=ACK len=0
2023/08/13 06:07:52 http2: Framer 0xc0001322a0: read HEADERS flags=END_HEADERS stream=1 len=81
2023/08/13 06:07:52 http2: decoded hpack field header field ":method" = "POST"
2023/08/13 06:07:52 http2: decoded hpack field header field ":scheme" = "http"
2023/08/13 06:07:52 http2: decoded hpack field header field ":path" = "/runtime.v1alpha2.RuntimeService/Version"
2023/08/13 06:07:52 http2: decoded hpack field header field ":authority" = "localhost:3381"
2023/08/13 06:07:52 http2: decoded hpack field header field "content-type" = "application/grpc"
2023/08/13 06:07:52 http2: decoded hpack field header field "user-agent" = "grpc-go/1.33.2"
2023/08/13 06:07:52 http2: decoded hpack field header field "te" = "trailers"
2023/08/13 06:07:52 http2: server read frame HEADERS flags=END_HEADERS stream=1 len=81
2023/08/13 06:07:52 http2: Framer 0xc0001322a0: read DATA flags=END_STREAM stream=1 len=15 data="\x00\x00\x00\x00\n\n\bv1alpha2"
2023/08/13 06:07:52 http2: server read frame DATA flags=END_STREAM stream=1 len=15 data="\x00\x00\x00\x00\n\n\bv1alpha2"
2023/08/13 06:07:52 request (://localhost:3381) POST /runtime.v1alpha2.RuntimeService/Version HTTP/2.0
2023/08/13 06:07:52 request headers map[Content-Type:[application/grpc] Te:[trailers] User-Agent:[grpc-go/1.33.2]]
2023/08/13 06:07:52 Dialing upstream: npipe:////./pipe/containerd-containerd
2023/08/13 06:07:52 http2: Transport creating client conn 0xc0000d8300 to //./pipe/containerd-containerd
2023/08/13 06:07:52 http2: Framer 0xc0000c80e0: wrote SETTINGS len=18, settings: ENABLE_PUSH=0, INITIAL_WINDOW_SIZE=4194304, MAX_HEADER_LIST_SIZE=10485760
2023/08/13 06:07:52 http2: Framer 0xc0000c80e0: wrote WINDOW_UPDATE len=4 (conn) incr=1073741824
2023/08/13 06:09:52 http2: Transport failed to get client conn for localhost:80: The pipe has been ended.
2023/08/13 06:09:52 http: proxy error: The pipe has been ended.
2023/08/13 06:09:52 http2: server encoding header ":status" = "502"
2023/08/13 06:09:52 http2: server encoding header "content-length" = "0"
2023/08/13 06:09:52 http2: server encoding header "date" = "Sun, 13 Aug 2023 06:09:52 GMT"
2023/08/13 06:09:52 http2: Framer 0xc0001322a0: wrote HEADERS flags=END_STREAM|END_HEADERS stream=1 len=31
2023/08/13 06:09:52 http2: Framer 0xc0001322a0: wrote WINDOW_UPDATE len=4 (conn) incr=15
2023/08/13 06:09:52 http2: Framer 0xc0001322a0: read RST_STREAM stream=1 len=4 ErrCode=PROTOCOL_ERROR
2023/08/13 06:09:52 http2: server read frame RST_STREAM stream=1 len=4 ErrCode=PROTOCOL_ERROR

client:

C:\Program Files\containerd>crictl.exe --runtime-endpoint tcp://localhost:3381 version
time="2023-08-13T06:09:52Z" level=fatal msg="getting the runtime version: rpc error: code = Unavailable desc = Bad Gateway: HTTP status code 502; transport: missing content-type field"

@azyshalom
Copy link
Author

@travisghansen
Copy link
Member

Hmm I’ll take a look.

Out of curiosity it looks like containerd/crictl support tcp directly, why do you need the proxy?

@azyshalom
Copy link
Author

Thanks, gRPC in C++ does not support named pipes, therefore im looking for tcp<=>namedpipe generic reverse proxy

@travisghansen
Copy link
Member

This should do it. I’ll see if I can get containerd running on my windows dev machine and try out your use-case.

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