Closed wangjia184 closed 8 months ago
Can you enable logs for h2
? That should show the frames sent and frames received. (h2
uses tracing
, you might need to enable tracing's log
feature to get interop).
Thanks @seanmonstar ,here is trace.log
[2023-11-04T00:26:15Z TRACE h2::proto::streams::streams] drop_stream_ref; stream=Stream { id: StreamId(1), state: State { inner: Closed(Error(Reset(StreamId(1), PROTOCOL_ERROR, Remote))) }, is_counted: false, ref_count: 1, next_pending_send: None, is_pending_send: false, send_flow: FlowControl { window_size: Window(1048264), available: Window(0) }, requested_send_capacity: 0, buffered_send_data: 0, send_task: None, pending_send: Deque { indices: None }, next_pending_send_capacity: None, is_pending_send_capacity: false, send_capacity_inc: true, next_open: None, is_pending_open: false, is_pending_push: false, next_pending_accept: None, is_pending_accept: false, recv_flow: FlowControl { window_size: Window(2097152), available: Window(2097152) }, in_flight_recv_data: 0, next_window_update: None, is_pending_window_update: false, reset_at: None, next_reset_expire: None, pending_recv: Deque { indices: None }, is_recv: true, recv_task: None, pending_push_promises: Queue { indices: None, _p: PhantomData<h2::proto::streams::stream::NextAccept> }, content_length: Omitted }
[2023-11-04T00:26:15Z TRACE h2::proto::streams::counts] transition_after; stream=StreamId(1); state=State { inner: Closed(Error(Reset(StreamId(1), PROTOCOL_ERROR, Remote))) }; is_closed=true; pending_send_empty=true; buffered_send_data=0; num_recv=0; num_send=0
[2023-11-04T00:26:15Z DEBUG hyper::proto::h2::client] client response error: stream error received: unspecific protocol error detected
[2023-11-04T00:26:15Z TRACE tracing::span::active] -> Connection;
[2023-11-04T00:26:15Z WARN ubs_edge::http_server] POST 127.0.0.1/UbsService/PredictBonus - http2 error: stream error received: unspecific protocol error detected
[2023-11-04T00:26:15Z TRACE tracing::span] poll;
[2023-11-04T00:26:15Z WARN hyper::proto::h2::server] http2 service errored: error from user's Service: http2 error: stream error received: unspecific protocol error detected
[2023-11-04T00:26:15Z TRACE tracing::span::active] -> poll;
[2023-11-04T00:26:15Z TRACE h2::proto::streams::send] send_reset(..., reason=PROTOCOL_ERROR, initiator=User, stream=StreamId(1), ..., is_reset=false; is_closed=false; pending_send.is_empty=true; state=State { inner: HalfClosedRemote(AwaitingHeaders) }
It looks fine until the server claims there's a protocol error with the request. What headers do you send?
I see where the problem is, the scheme
changed hence it needs be changed from http
to https
.
Unlike HTTP/1, Uri scheme is part of the header. thanks @seanmonstar
I have a reverse proxy basing on hyper and tokio. There are two backends, actually they are the same application but using different transport -- DotNet Core provides two transport choices. Kestrel and Http.sys(windows kernel driver, which only supports secure http/2, http.sys does not support plain-text http/2)
From the diagram.
Log below from rustls
Source code of handling upstreaming.
hyper::Client::request()
method failed with http2 error: stream error received: unspecific protocol error detected.The TLS shandshake succeeds but then it failed with this error immdetaitely. Checked on backend side. And there is no log from http.sys for this failed request.