fatmanverse opened a new issue, #13733:
URL: https://github.com/apache/seatunnel/issues/13733

   ### Search before asking
   
   - [x] I searched existing issues and PRs for `binary_chunk_size`, HTTP 
binary streaming, and overflow. I did not find a report covering this 
reproduction.
   
   ### What happened
   
   An Http source configured with `format = binary` accepts unusable 
`binary_chunk_size` values. With a five-byte response, both `0` and 
`4294967296` emit zero bytes and signal successful bounded completion. 
`4294967296L` becomes zero when narrowed to an int for the buffer. Negative and 
other out-of-int-range values are also accepted at initialization.
   
   Expected: reject invalid streaming chunk sizes before sending requests; 
valid sizes must preserve all bytes. A chunk size of `3` emits the full 
five-byte payload in the same test.
   
   I am working on a fix and will submit the corresponding PR.
   
   ### SeaTunnel Version
   
   `dev`, commit `0bef81d003a9dcc3266a10140dc639534ad81bfd` (`3.1.1-SNAPSHOT`).
   
   ### SeaTunnel Config
   
   ```hocon
   Http {
     url = "http://127.0.0.1:18080/file.bin";
     format = binary
     binary_chunk_size = 0 # also reproduces with 4294967296
   }
   ```
   
   The local HTTP endpoint returns status 200 and bytes `[1, 2, 3, 4, 5]`.
   
   ### Running Command
   
   Reproduced through `ReadonlyConfig -> HttpSource -> reader.pollNext()` 
against a real loopback HTTP server on a Linux test host. In a disposable 
checkout of the affected dev revision, copy the regression from the fix branch:
   
   ```sh
   git fetch https://github.com/fatmanverse/seatunnel.git 
fix-http-binary-chunk-size
   git checkout FETCH_HEAD -- 
seatunnel-connectors-v2/connector-http/connector-http-base/src/test/java/org/apache/seatunnel/connectors/seatunnel/http/HttpBinaryChunkSizeTest.java
   ./mvnw -pl seatunnel-connectors-v2/connector-http/connector-http-base -am \
     -DskipITs -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false \
     -Dsurefire.timeout=60 -Dtest=HttpBinaryChunkSizeTest clean verify
   ```
   
   The original production code fails to reject invalid sizes; valid-size and 
buffered-collector controls remain part of the test. Separate diagnostic tests 
on the original code measured the silent zero-byte output described above.
   
   ### Error Exception
   
   No runtime error for the two values above: the read returns normally. The 
diagnostic byte-conservation assertion fails: expected 5 bytes, actual 0. The 
`3`-byte control passes. This was reproduced on both JDK 11 and 17.
   
   ### Zeta or Flink or Spark Version
   
   Connector-level regression; no engine was started.
   
   ### Java or Scala Version
   
   Temurin JDK 11 and 17.
   
   ### Are you willing to submit PR?
   
   - [x] Yes, I am willing to submit a PR.
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's Code of Conduct.
   


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