eemario opened a new issue, #1119:
URL: https://github.com/apache/flink-agents/issues/1119

   ### Search before asking
   
   - [x] I searched in the 
[issues](https://github.com/apache/flink-agents/issues) and found nothing 
similar.
   
   ### Description
   
   ### Problem
   On JDK < 21, `durableExecuteAsync` runs inline on the mailbox thread — a 
single 500ms LLM call blocks the entire operator instance. Other keys' input 
records, watermarks, and checkpoints are stalled. JDK 21+ avoids this via 
Continuation.yield (Loom), but most production Flink deployments are still on 
JDK 8/11/17.
   ### Proposed Solution
   A coroutine-free parallel execution engine that runs action tasks on an 
elastic worker pool:
   1. Worker pulls an action task from Flink keyed state under a global lock.
   2. Sync phase (under lock): context setup → user action code runs until 
`durableExecuteAsync`.
   3. Async phase (lock released): the worker thread blocks on the async call 
(LLM, I/O) without holding the lock — other workers and the mailbox can proceed.
   4. Commit (mailbox thread): worker marks done → submits commit mail → 
mailbox drains completed tasks in FIFO order per key.
   The engine is automatically gated: activates only when 
`!ContinuationActionExecutor.isContinuationSupported()` (JDK < 21) and all 
actions are pure Java. JDK 21+ and Python agents keep the existing engine. The 
`durableExecuteAsync` / `RunnerContext` API is unchanged.
   Key guarantees preserved: per-key ordering (staged commits drain the queue 
in FIFO order), exactly-once (`maybePersistTaskResult` during mailbox commit), 
checkpoint correctness (quiesce in-flight tasks before barrier), and 
backpressure (via configured max-in-flight-input-records).
   ### Relationship to 
[#1109](https://github.com/apache/flink-agents/issues/1109)
   [#1109](https://github.com/apache/flink-agents/issues/1109) fixes JDK 21+ 
busy-wait polling with completion callbacks; this proposal provides the JDK < 
21 solution. The two are complementary — one addresses the Loom path, the other 
the no-Loom path.
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!


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