fatmanverse opened a new issue, #13731:
URL: https://github.com/apache/seatunnel/issues/13731
### Search before asking
- [x] I searched existing issues and PRs and found no duplicate of this
reproducer.
### What happened
When a paginated HTTP source receives HTTP 204 or HTTP 200 with an empty
body, it skips the code that updates pagination state. Requests can continue
beyond `total_page_size`, and unknown-total or Cursor pagination does not stop
on an empty response. A persistently empty endpoint can therefore keep a
bounded read running.
With `total_page_size = 2`, exactly two requests and no output rows. With
unknown total, exactly one empty request. With Cursor pagination, an empty
response has no next cursor and should stop. The original reader exceeds each
limit and reaches the test sentinel response.
### SeaTunnel Version
`dev`, `3.1.1-SNAPSHOT`, commit `0bef81d003a9dcc3266a10140dc639534ad81bfd`.
This report establishes the behavior on this revision; released-version
coverage was not tested.
### SeaTunnel Config
```hocon
env {
job.mode = "BATCH"
parallelism = 1
}
source {
Http {
url = "http://127.0.0.1:18080/pages?existing=ok"
format = "text"
keep_page_param_as_http_param = true
pageing = {
page_type = "PageNumber"
page_field = "page"
total_page_size = 2
batch_size = 1
}
}
}
sink { Console {} }
```
### Running Command
Reproduced through `HttpSource.createReader()` and `pollNext()` using a real
loopback HTTP server in a JUnit test. The loopback endpoint returns 204 (also
reproduced with empty 200) for the expected two pages. The test deliberately
returns 500 on an extra request so the regression fails promptly instead of
hanging. Unknown-total and Cursor cases use a one-request limit.
The [regression
test](https://github.com/fatmanverse/seatunnel/blob/037c6767c1d41996011b77df7debdd69aeb4905c/seatunnel-connectors-v2/connector-http/connector-http-base/src/test/java/org/apache/seatunnel/connectors/seatunnel/http/HttpSourceEmptyResponseTest.java)
starts its own server on a dynamically allocated port; no external service is
needed. To reproduce against the original production code at the revision
above, copy only that test into a disposable checkout and run:
```sh
# In a disposable checkout of the affected dev revision:
git fetch https://github.com/fatmanverse/seatunnel.git
fix-http-empty-response-pagination
git checkout 037c6767c1d41996011b77df7debdd69aeb4905c --
seatunnel-connectors-v2/connector-http/connector-http-base/src/test/java/org/apache/seatunnel/connectors/seatunnel/http/HttpSourceEmptyResponseTest.java
./mvnw -B -ntp -pl
seatunnel-connectors-v2/connector-http/connector-http-base -am \
-DskipITs -Dskip.spotless=true -Dsurefire.timeout=60 \
-Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false \
-Dtest=HttpSourceEmptyResponseTest clean verify
```
### Error Exception
```text
ErrorCode:[HTTP-02], ErrorDescription:[The request is failed] - http client
execute exception, http response status code:[500], content:[]
```
10 of 14 test cases fail on the original code; the remaining cases check
preserved behavior. The HTTP 500 is intentionally returned by the test endpoint
on an unexpected extra request; it is not the root cause.
### Zeta or Flink or Spark Version
Connector-level regression; no engine was started.
### Java or Scala Version
Original-code reproduction: Temurin 11.0.32.1 on Linux. The corresponding
fix was checked on JDK 11 and JDK 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](https://www.apache.org/foundation/policies/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]