You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "zentol (via GitHub)" <gi...@apache.org> on 2023/08/17 09:15:33 UTC

[GitHub] [flink] zentol opened a new pull request, #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

zentol opened a new pull request, #23229:
URL: https://github.com/apache/flink/pull/23229

   HttpPostRequestDecoder#hasNext() throws an `EndOfDataDecoderException` when called if all attributes were already read. There is apparently an edge-case where the a non empty HttpContent is received, but we already retrieved all attributes (so I guess it's just multipart metadata).
   
   We now assume that this isn't a problem; if it is the application layer should notice it (e.g., if a file/attribute is missing).


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] zentol commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "zentol (via GitHub)" <gi...@apache.org>.
zentol commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1297238420


##########
flink-runtime/src/test/java/org/apache/flink/runtime/rest/MultipartUploadExtension.java:
##########
@@ -119,6 +120,12 @@ public void before(ExtensionContext context) throws Exception {
         }
         file2 = TempDirUtils.newFile(tmpDirectory);
         Files.write(file2.toPath(), "world".getBytes(ConfigConstants.DEFAULT_CHARSET));
+        file3 = TempDirUtils.newFile(tmpDirectory);
+        try (RandomAccessFile rw = new RandomAccessFile(file3, "rw")) {
+            // magic value that reliably reproduced EndOfDataDecoderException in hasNext()
+            rw.setLength(1410);

Review Comment:
   It's not 100% reliable, but it worked for me pretty well.
   
   Just tried with different request sizes.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] XComp commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "XComp (via GitHub)" <gi...@apache.org>.
XComp commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1298126461


##########
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:
   interesting finding :+1: 



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] zentol commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "zentol (via GitHub)" <gi...@apache.org>.
zentol commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1297294632


##########
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:
   > ah true, I missed the part again where the NotEnoughDataDecoderException is thrown 🤦
   
   Found that out the hard way :sob: 



##########
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:
   > ah true, I missed the part again where the NotEnoughDataDecoderException is thrown 🤦
   
   Found that out the hard way :sob: 



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] XComp commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "XComp (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] zentol commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "zentol (via GitHub)" <gi...@apache.org>.
zentol commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1297287234


##########
flink-runtime/src/test/java/org/apache/flink/runtime/rest/MultipartUploadExtension.java:
##########
@@ -119,6 +120,12 @@ public void before(ExtensionContext context) throws Exception {
         }
         file2 = TempDirUtils.newFile(tmpDirectory);
         Files.write(file2.toPath(), "world".getBytes(ConfigConstants.DEFAULT_CHARSET));
+        file3 = TempDirUtils.newFile(tmpDirectory);
+        try (RandomAccessFile rw = new RandomAccessFile(file3, "rw")) {
+            // magic value that reliably reproduced EndOfDataDecoderException in hasNext()
+            rw.setLength(1410);

Review Comment:
   These things are very susceptible to interference from other requests or parts of the payload; for example if the JSON payload increases by a single byte it can already break the number.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] zentol commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "zentol (via GitHub)" <gi...@apache.org>.
zentol commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1297240436


##########
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:
   Which sucks a bit since you can't fail early on unknown attributes for example, and it'd be a larger change.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] XComp commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "XComp (via GitHub)" <gi...@apache.org>.
XComp commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1297240803


##########
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:
   ah true, I missed the part again where the `NotEnoughDataDecoderException` is thrown :facepalm: 



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] zentol commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "zentol (via GitHub)" <gi...@apache.org>.
zentol commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1297238420


##########
flink-runtime/src/test/java/org/apache/flink/runtime/rest/MultipartUploadExtension.java:
##########
@@ -119,6 +120,12 @@ public void before(ExtensionContext context) throws Exception {
         }
         file2 = TempDirUtils.newFile(tmpDirectory);
         Files.write(file2.toPath(), "world".getBytes(ConfigConstants.DEFAULT_CHARSET));
+        file3 = TempDirUtils.newFile(tmpDirectory);
+        try (RandomAccessFile rw = new RandomAccessFile(file3, "rw")) {
+            // magic value that reliably reproduced EndOfDataDecoderException in hasNext()
+            rw.setLength(1410);

Review Comment:
   It's not 100% reliable, but it worked for me pretty well.
   
   Just tried different request sizes until things started to fail.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] dmvk commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "dmvk (via GitHub)" <gi...@apache.org>.
dmvk commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1297666601


##########
flink-runtime/src/test/java/org/apache/flink/runtime/rest/MultipartUploadExtension.java:
##########
@@ -119,6 +120,12 @@ public void before(ExtensionContext context) throws Exception {
         }
         file2 = TempDirUtils.newFile(tmpDirectory);
         Files.write(file2.toPath(), "world".getBytes(ConfigConstants.DEFAULT_CHARSET));
+        file3 = TempDirUtils.newFile(tmpDirectory);
+        try (RandomAccessFile rw = new RandomAccessFile(file3, "rw")) {
+            // magic value that reliably reproduced EndOfDataDecoderException in hasNext()
+            rw.setLength(1410);

Review Comment:
   If it's worth anything, the magic number breaks things for me 🪄 (m1 mac)
   
   ```
   [ERROR] Tests run: 9, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.23 s <<< FAILURE! - in org.apache.flink.runtime.rest.FileUploadHandlerITCase
   [ERROR] org.apache.flink.runtime.rest.FileUploadHandlerITCase.testMixedMultipartEndOfDataDecoderExceptionHandling(Path)  Time elapsed: 0.099 s  <<< FAILURE!
   org.opentest4j.AssertionFailedError:
   
   expected: 200
    but was: 500
   	at java.base/jdk.i
   ```



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] XComp commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "XComp (via GitHub)" <gi...@apache.org>.
XComp commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1297168003


##########
flink-runtime/src/test/java/org/apache/flink/runtime/rest/MultipartUploadExtension.java:
##########
@@ -119,6 +120,12 @@ public void before(ExtensionContext context) throws Exception {
         }
         file2 = TempDirUtils.newFile(tmpDirectory);
         Files.write(file2.toPath(), "world".getBytes(ConfigConstants.DEFAULT_CHARSET));
+        file3 = TempDirUtils.newFile(tmpDirectory);
+        try (RandomAccessFile rw = new RandomAccessFile(file3, "rw")) {
+            // magic value that reliably reproduced EndOfDataDecoderException in hasNext()
+            rw.setLength(1410);

Review Comment:
   The test doesn't fail if I revert the fix. That makes me believe that this magic value doesn't reproduce the scenario reliably. How did you come up with the test scenario? :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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] dmvk commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "dmvk (via GitHub)" <gi...@apache.org>.
dmvk commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1298123152


##########
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:
   the contract of hasNext method seems just awful (I'm still puzzled they simply don't return false), but it seems that netty even recommends this approach in examples
   
   https://github.com/netty/netty/blob/6fc60e04649ae3873f0f52ecb3a387245215dbad/example/src/main/java/io/netty/example/http/upload/HttpUploadServerHandler.java#L252



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] dmvk commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "dmvk (via GitHub)" <gi...@apache.org>.
dmvk commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1297666601


##########
flink-runtime/src/test/java/org/apache/flink/runtime/rest/MultipartUploadExtension.java:
##########
@@ -119,6 +120,12 @@ public void before(ExtensionContext context) throws Exception {
         }
         file2 = TempDirUtils.newFile(tmpDirectory);
         Files.write(file2.toPath(), "world".getBytes(ConfigConstants.DEFAULT_CHARSET));
+        file3 = TempDirUtils.newFile(tmpDirectory);
+        try (RandomAccessFile rw = new RandomAccessFile(file3, "rw")) {
+            // magic value that reliably reproduced EndOfDataDecoderException in hasNext()
+            rw.setLength(1410);

Review Comment:
   If it's worth anything, the magic number break things for me 🪄 
   
   ```
   [ERROR] Tests run: 9, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.23 s <<< FAILURE! - in org.apache.flink.runtime.rest.FileUploadHandlerITCase
   [ERROR] org.apache.flink.runtime.rest.FileUploadHandlerITCase.testMixedMultipartEndOfDataDecoderExceptionHandling(Path)  Time elapsed: 0.099 s  <<< FAILURE!
   org.opentest4j.AssertionFailedError:
   
   expected: 200
    but was: 500
   	at java.base/jdk.i
   ```



##########
flink-runtime/src/test/java/org/apache/flink/runtime/rest/MultipartUploadExtension.java:
##########
@@ -119,6 +120,12 @@ public void before(ExtensionContext context) throws Exception {
         }
         file2 = TempDirUtils.newFile(tmpDirectory);
         Files.write(file2.toPath(), "world".getBytes(ConfigConstants.DEFAULT_CHARSET));
+        file3 = TempDirUtils.newFile(tmpDirectory);
+        try (RandomAccessFile rw = new RandomAccessFile(file3, "rw")) {
+            // magic value that reliably reproduced EndOfDataDecoderException in hasNext()
+            rw.setLength(1410);

Review Comment:
   If it's worth anything, the magic number break things for me 🪄 
   
   ```
   [ERROR] Tests run: 9, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.23 s <<< FAILURE! - in org.apache.flink.runtime.rest.FileUploadHandlerITCase
   [ERROR] org.apache.flink.runtime.rest.FileUploadHandlerITCase.testMixedMultipartEndOfDataDecoderExceptionHandling(Path)  Time elapsed: 0.099 s  <<< FAILURE!
   org.opentest4j.AssertionFailedError:
   
   expected: 200
    but was: 500
   	at java.base/jdk.i
   ```



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] zentol commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "zentol (via GitHub)" <gi...@apache.org>.
zentol commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1298178492


##########
flink-runtime/src/test/java/org/apache/flink/runtime/rest/MultipartUploadExtension.java:
##########
@@ -119,6 +120,12 @@ public void before(ExtensionContext context) throws Exception {
         }
         file2 = TempDirUtils.newFile(tmpDirectory);
         Files.write(file2.toPath(), "world".getBytes(ConfigConstants.DEFAULT_CHARSET));
+        file3 = TempDirUtils.newFile(tmpDirectory);
+        try (RandomAccessFile rw = new RandomAccessFile(file3, "rw")) {
+            // magic value that reliably reproduced EndOfDataDecoderException in hasNext()
+            rw.setLength(1410);

Review Comment:
   done



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] flinkbot commented on pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #23229:
URL: https://github.com/apache/flink/pull/23229#issuecomment-1681935539

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "f962bdf1e05e41440f8996dcd0b6511104175371",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "f962bdf1e05e41440f8996dcd0b6511104175371",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * f962bdf1e05e41440f8996dcd0b6511104175371 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] zentol commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "zentol (via GitHub)" <gi...@apache.org>.
zentol commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1297239508


##########
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() 
   
   You can only call `getBodyHttpDatas` once you've read everything.
   
   



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] XComp commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "XComp (via GitHub)" <gi...@apache.org>.
XComp commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1297168003


##########
flink-runtime/src/test/java/org/apache/flink/runtime/rest/MultipartUploadExtension.java:
##########
@@ -119,6 +120,12 @@ public void before(ExtensionContext context) throws Exception {
         }
         file2 = TempDirUtils.newFile(tmpDirectory);
         Files.write(file2.toPath(), "world".getBytes(ConfigConstants.DEFAULT_CHARSET));
+        file3 = TempDirUtils.newFile(tmpDirectory);
+        try (RandomAccessFile rw = new RandomAccessFile(file3, "rw")) {
+            // magic value that reliably reproduced EndOfDataDecoderException in hasNext()
+            rw.setLength(1410);

Review Comment:
   The test doesn't fail on my machine if I revert the fix. That makes me believe that this magic value doesn't reproduce the scenario reliably. How did you come up with the test scenario? :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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] zentol commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "zentol (via GitHub)" <gi...@apache.org>.
zentol commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1297283656


##########
flink-runtime/src/test/java/org/apache/flink/runtime/rest/MultipartUploadExtension.java:
##########
@@ -119,6 +120,12 @@ public void before(ExtensionContext context) throws Exception {
         }
         file2 = TempDirUtils.newFile(tmpDirectory);
         Files.write(file2.toPath(), "world".getBytes(ConfigConstants.DEFAULT_CHARSET));
+        file3 = TempDirUtils.newFile(tmpDirectory);
+        try (RandomAccessFile rw = new RandomAccessFile(file3, "rw")) {
+            // magic value that reliably reproduced EndOfDataDecoderException in hasNext()
+            rw.setLength(1410);

Review Comment:
   @XComp can you try again with the new magic number?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] XComp commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "XComp (via GitHub)" <gi...@apache.org>.
XComp commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1298127414


##########
flink-runtime/src/test/java/org/apache/flink/runtime/rest/MultipartUploadExtension.java:
##########
@@ -119,6 +120,12 @@ public void before(ExtensionContext context) throws Exception {
         }
         file2 = TempDirUtils.newFile(tmpDirectory);
         Files.write(file2.toPath(), "world".getBytes(ConfigConstants.DEFAULT_CHARSET));
+        file3 = TempDirUtils.newFile(tmpDirectory);
+        try (RandomAccessFile rw = new RandomAccessFile(file3, "rw")) {
+            // magic value that reliably reproduced EndOfDataDecoderException in hasNext()
+            rw.setLength(1410);

Review Comment:
   Ya, it fails for me now quite reliably as well with the fix being commented-out.
   
   > These things are very susceptible to interference from other requests or parts of the payload; for example if the JSON payload increases by a single byte it can already break the number.
   
   Is it worth adding this information to the test method?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] zentol merged pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "zentol (via GitHub)" <gi...@apache.org>.
zentol merged PR #23229:
URL: https://github.com/apache/flink/pull/23229


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] zentol commented on a diff in pull request #23229: [FLINK-32888] Handle hasNext() throwing EndOfDataDecoderException

Posted by "zentol (via GitHub)" <gi...@apache.org>.
zentol commented on code in PR #23229:
URL: https://github.com/apache/flink/pull/23229#discussion_r1297244058


##########
flink-runtime/src/test/java/org/apache/flink/runtime/rest/MultipartUploadExtension.java:
##########
@@ -119,6 +120,12 @@ public void before(ExtensionContext context) throws Exception {
         }
         file2 = TempDirUtils.newFile(tmpDirectory);
         Files.write(file2.toPath(), "world".getBytes(ConfigConstants.DEFAULT_CHARSET));
+        file3 = TempDirUtils.newFile(tmpDirectory);
+        try (RandomAccessFile rw = new RandomAccessFile(file3, "rw")) {
+            // magic value that reliably reproduced EndOfDataDecoderException in hasNext()
+            rw.setLength(1410);

Review Comment:
   meh now it stopped failing for me, hold on. Could be that some of the refactorings changed the number.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org