diff --git a/docs/contracts/inbound-r6-declarations.json b/docs/contracts/inbound-r6-declarations.json index 6903b8d..1583efc 100644 --- a/docs/contracts/inbound-r6-declarations.json +++ b/docs/contracts/inbound-r6-declarations.json @@ -516,7 +516,7 @@ "name": "handleSubmit", "kind": "func", "file": "submit.go", - "sha256": "9d6590964ba080a55758ee7fee0b3acefc398ce81d3d13fd7eac4660b2d90e68" + "sha256": "16a7bb939824b18ea13698293f2868a25a7cb525e318a1c6b00597f37be12466" }, { "name": "inboundLongMessageFragment", diff --git a/docs/testing-progress.md b/docs/testing-progress.md index 1e2cf90..3d97894 100644 --- a/docs/testing-progress.md +++ b/docs/testing-progress.md @@ -3731,3 +3731,5 @@ git diff --check - 项目内gocmpp服务循环只对CMPP2/3 Submit启用并发;连接退出前等待已接受的在途处理完成后才调用会话清理,代码注释解释了这是为了防止迟到API处理重新注册已关闭连接。新增聚合指标`cmpp_gateway_inbound_submit_slots{state=configured|in_flight}`,不带账号、应用、连接或消息标签。 - 专项集成测试已证明窗口2时,第1个Submit被API阻塞后,第2个Submit可进入API并以自身Sequence_Id先返回;释放后第1个响应仍按原Sequence_Id返回。Gateway全量`go test ./... -count=1`和`go vet ./...`、项目内gocmpp测试/vet、API TypeScript正式编译、真实隔离Redis上的SendChain 113/113项、4份Stream契约、R6的102声明/14项关键测试、R7及SendChain R10门禁和`git diff --check`通过。Windows本机`go test -race`因Go工具链未启用CGO而无法运行,未伪报通过;将在Linux测试环境部署前补跑。测试环境恢复资产、部署和阶梯压测待后续补记。 - 当前只修改本地代码,没有连接或改变预生产运行版本;预生产只读标识仍为`433b2ee56f6016ad8afff1bac73f510b8fd53083+gateway-v2.cd7bb8d05e7b`。V3只允许发布到`100.93.204.60`虚拟机测试环境。 +- V3首次测试环境发布后10条/秒为599/599成功、P50/P95/P99=36/78/206ms;20条/秒为1199/1199成功,但P50/P95/P99=1143/5294/7107ms,仍触发5秒停止线,因此没有继续30/40/50。Prometheus同时显示认证阶段10个连接合计窗口320,但压测期入站in_flight始终为0;代码复核发现首次消息完成后`rememberDownstream`用消息级快照覆盖`byConn`时没有继承连接的`windowSize/submitInFlight`,使后续请求退回串行。该次20条/秒结果不作为修复后V3容量结论。 +- 最小修复让消息级快照共享原连接窗口和原子在途计数器,并增加“消息注册后窗口32及聚合槽位仍保持”的回归断言;需重新完成Gateway/API回归、R6契约、提交、测试环境发布与10/20阶梯复测后再判断V3效果。 diff --git a/gateway/internal/inbound/server_test.go b/gateway/internal/inbound/server_test.go index 58c6701..0175855 100644 --- a/gateway/internal/inbound/server_test.go +++ b/gateway/internal/inbound/server_test.go @@ -346,6 +346,21 @@ func TestBoundedSubmitWindowAndAggregateSlotSnapshot(t *testing.T) { if configured != 48 || inFlight != 4 { t.Fatalf("slot snapshot configured=%d in_flight=%d, want 48/4", configured, inFlight) } + + conn := &cmpp.Conn{} + counter := &atomic.Int64{} + counter.Store(2) + rememberDownstream(downstreamSession{ + messageID: "MSG-WINDOW-SNAPSHOT", account: "100030", conn: conn, + windowSize: 32, submitInFlight: counter, + }) + if got := submitWindowByConn(conn); got != 32 { + t.Fatalf("message registration replaced connection window with %d, want 32", got) + } + configured, inFlight = SubmitSlotSnapshot() + if configured != 80 || inFlight != 6 { + t.Fatalf("post-message slot snapshot configured=%d in_flight=%d, want 80/6", configured, inFlight) + } } func TestDecodeInboundLongMessageStripsConcatUDHBeforeUCS2Decode(t *testing.T) { diff --git a/gateway/internal/inbound/submit.go b/gateway/internal/inbound/submit.go index e01164b..bb7aaa8 100644 --- a/gateway/internal/inbound/submit.go +++ b/gateway/internal/inbound/submit.go @@ -169,6 +169,8 @@ func (s Server) handleSubmit(response *cmpp.Response, packet *cmpp.Packet, logge applicationID: result.ApplicationID, enterpriseCode: session.enterpriseCode, protocol: clientProtocol, + windowSize: session.windowSize, + submitInFlight: session.submitInFlight, srcID: strings.TrimSpace(req.srcID), phoneNumber: acceptedPhone, gatewayMsgID: gatewayMsgID,