aglinxinyuan opened a new issue, #7246:
URL: https://github.com/apache/texera/issues/7246

   ### What happened?
   
   A Loop End with two inbound links into its single input port has **no 
runtime guard**. Unlike Loop Start, it does not fail at `StartWorkflow` — it 
runs and silently double-consumes.
   
   Every reader on a materialized input port replays that port's states 
independently, so a second link delivers the loop state twice per iteration: 
the user's `update` runs twice and the back-edge is written twice, producing a 
wrong iteration count with no error.
   
   ### Root cause
   
   The only runtime check lives in 
`WorkflowExecutionManager.loopStartPortUris`, and it sits under 
`filter(_.isLoopStart)`:
   
   ```scala
   region.getOperators.filter(_.isLoopStart).map { op =>
     require(cfg.storagePairs.size == 1, s"Loop Start input port $gpid expected 
exactly one reader URI, ...")
   ```
   
   So the `require` only ever sees Loop Start operators. There is no 
`isLoopEnd` marker on `PhysicalOp` and no equivalent check for the Loop End 
side.
   
   #7154 declares `disallowMultiLinks` on the shared `LoopOpDesc` input port, 
which stops the GUI drawing a second link into **either** loop operator — but 
that is a GUI guard. Plans built programmatically (the case in #6966) bypass it 
entirely, and for Loop End nothing downstream catches the mistake.
   
   ### Expected behavior
   
   | | Loop Start | Loop End |
   |---|---|---|
   | GUI (after #7154) | 2nd link refused | 2nd link refused |
   | Programmatic plan, 2 links | fails at `StartWorkflow` | **runs and 
double-consumes** ← the gap |
   
   A matching runtime check for Loop End would close it — e.g. an `isLoopEnd` 
flag on `PhysicalOp` (mirroring `isLoopStart`) plus a `require` on its input 
port's reader count, or a general single-reader assertion applied to any port 
whose descriptor declares `disallowMultiLinks`. The latter is more general and 
would cover future single-input operators too.
   
   Raised in review of #7154.
   


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