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

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22Bug%22)
 and found no similar issues.
   
   ### What happened
   
   With `read_limit.bytes_per_second` configured, the task aborts on the first 
row that measures zero bytes:
   
   ```
   java.lang.IllegalArgumentException: Requested permits (0) must be positive
   ```
   
   `FlowControlGate#audit` passes the row size straight to Guava's 
`RateLimiter#acquire`:
   
   ```java
   public void audit(SeaTunnelRow row) {
       bytesRateLimiter.ifPresent(rateLimiter -> 
rateLimiter.acquire(row.getBytesSize()));
       countRateLimiter.ifPresent(RateLimiter::acquire);
   }
   ```
   
   `RateLimiter#acquire(int)` requires a positive permit count — `checkPermits` 
does `checkArgument(permits > 0, "Requested permits (%s) must be positive", 
permits)`.
   
   **A zero-byte row is not a corner case.** `SeaTunnelRow#getBytesForValue` 
returns `0` for `null` and `String#length()` for a string, so `getBytesSize()` 
returns exactly 0 for:
   
   - a row whose selected columns are all `NULL`
   - a row whose selected columns are all empty strings (e.g. a CSV line of 
empty fields)
   
   The failure surfaces as an argument-validation error from inside shaded 
Guava, so it reads as an engine fault rather than a throttling decision — and 
it only appears for users who enabled byte throttling, which makes it look 
unrelated to their data.
   
   ### SeaTunnel Version
   
   dev
   
   ### SeaTunnel Config
   
   ```conf
   env {
     read_limit.bytes_per_second = 100
   }
   ```
   
   ### Running Command
   
   Any job with the above `env` block over a source that can yield an all-null 
or all-empty row.
   
   ### Error Exception
   
   ```log
   java.lang.IllegalArgumentException: Requested permits (0) must be positive
        at 
org.apache.seatunnel.shade.com.google.common.util.concurrent.RateLimiter.checkPermits(RateLimiter.java:...)
        at 
org.apache.seatunnel.shade.com.google.common.util.concurrent.RateLimiter.reserve(RateLimiter.java:...)
        at 
org.apache.seatunnel.shade.com.google.common.util.concurrent.RateLimiter.acquire(RateLimiter.java:...)
        at 
org.apache.seatunnel.core.starter.flowcontrol.FlowControlGate.lambda$audit$0(FlowControlGate.java:47)
   ```
   
   Reproduced as a unit test against `FlowControlGateTest`:
   
   ```java
   FlowControlGate gate = 
FlowControlGate.create(FlowControlStrategy.ofBytes(100));
   gate.audit(new SeaTunnelRow(new Object[] {null, null}));   // throws today
   ```
   
   ### Zeta or Flink or Spark Version
   
   All — `FlowControlGate` lives in `seatunnel-core-starter`.
   
   ### Java or Scala Version
   
   _No response_
   
   ### Screenshots
   
   _No response_
   
   ### 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]

Reply via email to