alibaba / xquic

XQUIC Library released by Alibaba is a cross-platform implementation of QUIC and HTTP/3 protocol.
Apache License 2.0
1.65k stars 326 forks source link

[Bug]: 服务端多个流内存占用越来越大 #244

Open adcen0107 opened 1 year ago

adcen0107 commented 1 year ago

What happened?

1、xquic stream的大小发送端会限制(默认为32M),而接收端并不会限制; 接收端收流处理函数xqc_process_stream_frame,将stream_frame插入stream后,执行receiver flow control,仅是简单更新流统计信息 / receiver flow control / if (stream->stream_max_recv_offset < stream_frame->data_offset + stream_frame->data_length) { conn->conn_flow_ctl.fc_data_recved += stream_frame->data_offset + stream_frame->data_length - stream->stream_max_recv_offset; stream->stream_max_recv_offset = stream_frame->data_offset + stream_frame->data_length; } 2、只有接收端的流被应用层真正读取,才会触发全局的conn流控; xqc_stream_do_recv_flow_ctl 3、若接收端底层收到stream,但应用层没有完成真正的数据读取,会导致流一直存储在内存。 服务端同时接收多个流(默认支持1024?),且这些流被QUIC层收取但都未被应用层读取,则会导致内存消耗巨大的问题。 4、建议修改方法,接收端在process_stream_frame时执行一个全局的 conn level flow control。

Steps To Reproduce

1、client - server 进行多流传输; 2、server注释 xqc_stream_recv逻辑; 3、观察服务端内存消耗量。

Relevant log output

No response