go network_error ai_generated partial

rpc 错误:code = Internal desc = 传输层:在流 3 上收到了意外的 HTTP/2 HEADERS 帧

rpc error: code = Internal desc = transport: received unexpected HTTP/2 frame of type HEADERS on stream 3

ID: go/grpc-internal-http2-frame-error

其他格式: JSON · Markdown 中文 · English
80%修复率
82%置信度
0证据数
2024-07-03首次发现

版本兼容性

版本状态引入弃用备注
1.50+ active — — —

根因分析

客户端与服务端之间的代理或负载均衡器破坏或重排了 HTTP/2 帧,通常是 L7 代理未正确支持 HTTP/2,或终止 TLS 后降级为 HTTP/1.1。

English

A proxy or load balancer between client and server is corrupting or reordering HTTP/2 frames, often an L7 proxy that does not speak HTTP/2 correctly or is terminating TLS and downgrading to HTTP/1.1.

generic

解决方案

  1. 85% 成功率
    // nginx example
    // listen 50051 http2;
    // proxy_http_version 1.1;  // WRONG for gRPC
    // proxy_set_header Connection "";
    // use grpc_pass grpc://backend:50051;
  2. 80% 成功率
    conn, err := grpc.Dial("backend:50051", grpc.WithTransportCredentials(insecure.NewCredentials()))
    // if direct works, replace L7 proxy with Envoy/Linkerd or gRPC-native LB

无效尝试

常见但无效的做法:

  1. 85% 失败

    The error is about frame ordering, not message size; the limit has no effect on frame parsing.

  2. 80% 失败

    Blocking dial only affects connection establishment, not post-connect frame handling.