XComp commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1297229877


##########
flink-runtime/src/main/java/org/apache/flink/runtime/rest/FileUploadHandler.java:
##########
@@ -212,6 +212,16 @@ protected void channelRead0(final ChannelHandlerContext 
ctx, final HttpObject ms
         }
     }
 
+    private static boolean hasNext(HttpPostRequestDecoder decoder) {
+        try {
+            return decoder.hasNext();
+        } catch (HttpPostRequestDecoder.EndOfDataDecoderException e) {
+            // this can occur if the final chuck wasn't empty, but didn't 
contain any attribute data
+            // unfortunately the Netty APIs don't give us any way to check this

Review Comment:
   we could maintain the size of 
`currentHttpPostRequestDecoder.getBodyHttpDatas()` (that's essentially what the 
`hasNext()`/`next()` methods access and which increases with every `offer(..)` 
call): Only if the size of the returned List increases we now that there is 
more data to read. 
   
   That's the only workaround I could come up with based on what I found from 
reading through the `HttpPostMultipartRequestDecoder` iteration code and from 
what I found in https://github.com/netty/netty/issues/7869. Not sure whether 
that's a nicer approach, though. :thinking: 



-- 
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