apache / apache/dubbo

why send flow control error when connection window is 0

Open
#13,676 6 comments 0 reactions 0 assignees View on GitHub
component/sdk help wanted type/enhancement
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

对于dubbo自定义的http2 流控窗口逻辑有点疑惑.

复现步骤:
dubbo version: 3.2.x
1. 调整peer initialize window size from 8M to 64k(65535) 越小越容易复现.
2. provider实现一个大数据返参接口.(如 listUser)

TriHttp2RemoteFlowController
```java
// FlowState
int writeAllocatedBytes(int allocated) {
...
try {
...
} finally {
...
// 当connection window为0时, 此时会直接发送flow control error, 阻断连接.
if(monitor.isOverFlowControl()){
logger.info(String.format("[HTTP2] connection window throttling, stream:%d overflow flow controlling", stream.id()));
// cause = new Throwable();
// cancel(FLOW_CONTROL_ERROR,cause);
}
}
return writtenBytes;
}
```
provider报:

> Caused by: io.netty.handler.codec.http2.Http2Exception$StreamException: TotalPendingBytes size overflow for stream: 3
at io.netty.handler.codec.http2.Http2Exception.streamError(Http2Exception.java:153)
at org.apache.dubbo.rpc.protocol.tri.TriHttp2RemoteFlowController$ListenerWritabilityMonitor.checkConnectionThenStreamWritabilityChanged(TriHttp2RemoteFlowController.java:794)
at org.apache.dubbo.rpc.protocol.tri.TriHttp2RemoteFlowController$ListenerWritabilityMonitor.stateCancelled(TriHttp2RemoteFlowController.java:755)
... 35 common frames omitted

这里很好奇, http2 官方协议并没有规定, 当 connection window为0 时 直接发送 flow_control_error. 常规做法不应该是暂停发送, 等待
窗口更新后 继续传输么?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.