Hi Richard and all,

I have touched one part of this in an open changelist ->
https://github.com/apache/storm/pull/9302,
specifically distinguishing spout timeouts from explicit failures from
explicit failures in the worker log.

I'd suggest taking a look; Cheers,
Davide



Il giorno dom 29 nov 2026 alle ore 19:17 Richard Zowalla via dev
<[email protected]> ha scritto:

>
> Hi Karthick,
>
> as written in the past: please do not cross-post. It is totally fine to send 
> this to [email protected] only.
> Please also note that JIRA is gone: the project now uses GitHub Issues 
> (https://github.com/apache/storm/issues), so new issues and design 
> discussions should go there.
>
> Thanks for the detailed write-up. Before answering your questions, note that 
> 2.8.x is end of life.
> The current release is 3.2.0, and we have fixed several things in this area 
> over the last months. It would be good to re-test on 3.2.x first:
>
> - #8892 (3.0.0): an optional control receive queue 
> (topology.executor.receive.control.queue.enable). System streams, including 
> acks, are drained before data tuples, so under load acks no longer wait 
> behind queued data.
> This should reduce the "slow tuple times out" case in your Problem 2, 
> although time a data tuple spends in a queue still counts.
> - #9175 (3.2.0): upstream feedback tuples to tasks on other workers were 
> dropped. This is not your scenario, but it is in the same area of messages 
> getting lost between workers.
> - #9093 (3.2.0): the Kafka spout now logs at error level when it gives up on 
> a tuple after the maximum number of retries, and documents that it then acks 
> it and may commit past its offset.
> - #9280 (docs, merged): explains how a record that is never acked blocks 
> Kafka spout commits, and the current mitigations (a finite maxRetries plus 
> KafkaTupleListener.onMaxRetryReached).
>
> To your questions:
>
> 1. Existing discussions. Problem 2 is essentially STORM-2359 ("Revising 
> message timeouts") from the old JIRA. A recent attempt at a progress-based 
> timeout (#8787) was closed without being merged; the discussion there covers 
> why only resetting the acker's view does not help, because the spout enforces 
> the timeout. #9078 is open for the Kafka spout side of records that are never 
> acked. I'm not aware of an existing issue for your Problem 1. Note that 
> running with timeouts disabled while max.spout.pending is set has always been 
> a known way to stall a spout.
> 2. Delivering an ack after the timeout fired. The main thing to check is the 
> acker. It tracks tuple trees in its own rotating map, which is also driven by 
> the message timeout. If the acker has already forgotten a tree, the late ack 
> never reaches the spout, so the extra rotation on the spout side has to stay 
> within what the acker still remembers. Beyond that, please check that 
> complete-latency and failed/acked metrics, spout hooks and the event logger 
> only see one outcome per tuple, and at the right time.
> 3. Upstream. Yes, this sounds interesting. I'd suggest first opening a GitHub 
> issue that describes both problems and the design, so the discussion happens 
> in one place. After that, three separate PRs against master would be easier 
> to review than one. Changes 2 and 3 add public API (a spout interface and a 
> collector method), which needs careful review on its own, and change 1 is a 
> behaviour change in the executor. As 2.8.x is end of life, these would go 
> into 3.x.
>
> Thanks again for the thorough analysis and the local reproductions.
>
> Regards,
> Richard
>
> > Am 29.11.2026 um 09:18 schrieb Karthick <[email protected]>:
> >
> > Hi all,
> >
> >  We run a Kafka-fed topology on Storm 2.8.x with acking enabled and
> > topology.max.spout.pending set. The spout moves its Kafka position forward
> > only after a tuple
> >  tree is fully acked. We hit two problems and would like your feedback on
> > a fix we're testing.
> >
> >  Problem 1: with message timeouts off, a worker crash stops spouts on
> > other workers
> >
> >  We killed one worker (kill -9). The supervisor restarted it within
> > seconds, but spouts on the other workers stopped emitting and never
> > recovered until we restarted
> >  the topology.
> >
> >  What we found:
> >  - Tuple trees that passed through the dead worker never complete. Their
> > tuples and acks were lost with it, or dropped while the connection was down.
> >  - Nobody fails these trees. The acker can't tell "lost" from "still in
> > progress", and the bolt that held the tuple is gone.
> >  - With timeouts off, their entries stay in the spout's pending map
> > forever. Once a spout has max.spout.pending of them, it stops calling
> > nextTuple for good.
> >  - When Kafka moves a partition to another consumer, those entries still
> > stay, because the pending map knows nothing about partitions. So the newly
> > assigned
> >    partitions are stuck too.
> >
> >  We understand that the message timeout is the intended way to recover
> > from this.
> >
> >  Problem 2: with message timeouts on, slow tuples are failed as well as
> > lost ones
> >
> >  The timeout clock starts at emit, so time spent waiting in queues counts.
> > Under load, tuples that are only waiting their turn also time out. Storm
> > then:
> >  - calls fail() on the spout,
> >  - but doesn't stop the tuple, which is still processed shortly after,
> >  - and drops its later ack, because the pending entry has already been
> > removed.
> >
> >  So the spout can't tell a slow tuple from a lost one. If it re-emits on
> > every fail, slow tuples get processed twice. If it treats the fail as done,
> > it can move
> >  past a record that hasn't finished processing yet, and a crash at that
> > moment loses it. We reproduced both outcomes in local tests.
> >
> >  What we're testing (three small changes, all off unless a topology config
> > enables them)
> >
> >  1. Late ack after a timeout. When a tuple times out, move its entry from
> > pending to a second rotating map instead of failing it. This frees its
> > max.spout.pending
> >     slot. If its ack (or fail) arrives within one more rotation, deliver
> > it to the spout as normal. Only if it expires there too is the spout's
> > fail() called. Slow
> >     tuples complete normally, and only trees that never finish reach the
> > spout as failed.
> >  2. Tell the spout why it failed. An optional spout interface, fail(Object
> > msgId, String reason), with the reason TIMEOUT or FAIL-STREAM. The spout
> > can then re-emit
> >     a presumed-lost tuple but treat a bolt-reported failure differently.
> >  3. Let the spout drop its own pending entries. A default method on the
> > spout output collector, dropPending(Predicate<Object> msgIdMatch), safe
> > from any thread and
> >     applied on the spout thread. It removes matching entries emitted
> > before the call, without calling ack or fail. A Kafka spout calls it after
> > a rebalance for
> >     partitions it no longer owns, so they stop holding max.spout.pending.
> >
> >  In local tests (LocalCluster plus Kafka, with a bolt that silently drops
> > some tuples for a few seconds to imitate a dead worker):
> >  - stock behaviour with timeouts off stalls until restart;
> >  - stock behaviour with timeouts on can skip records;
> >  - with the three changes, there is no stall and no record is lost, and
> > only the lost tuples are re-emitted.
> >
> >  Questions
> >  1. Is there an existing JIRA or discussion about either problem? We may
> > have missed it.
> >  2. Do you see a problem with delivering an ack to the spout after its
> > timeout has fired, for example with metrics, hooks or the event logger?
> >  3. Would changes like these be considered for upstream, and if so, as one
> > change or three?
> >
> > Thanks,
> > Karthick
>

Reply via email to