Copilot commented on code in PR #18793:
URL: https://github.com/apache/iotdb/pull/18793#discussion_r4196462701


##########
iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java:
##########
@@ -194,10 +194,14 @@ public int read(byte[] buf, int off, int len) throws 
TTransportException {
   }
 
   protected void readFrame() throws TTransportException {
+    // Discard the previous frame's budget before reading the next frame 
header and payload.
+    resetMessageSizeAndConsumedBytes();
     underlying.readAll(i32buf, 0, 4);
     int size = TFramedTransport.decodeFrameSize(i32buf);
     validateFrame(size);
     readBuffer.fill(underlying, size);
+    // Bind subsequent protocol reads to the current frame size.
+    resetMessageSizeAndConsumedBytes(size);

Review Comment:
   The new budget reset only runs for uncompressed frames. 
`TCompressedElasticFramedTransport` overrides `readFrame()` and never calls 
this implementation, so Snappy connections continue charging every frame 
against the underlying transport's single message budget and will eventually 
fail after enough data has been read on a persistent connection. Apply the same 
reset-before-header/reset-after-payload lifecycle in the compressed override 
(and cover the Snappy path in the regression test), or refactor the shared 
framing logic so overrides cannot skip it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to