You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "He-Pin (via GitHub)" <gi...@apache.org> on 2026/06/20 12:06:35 UTC
[I] IdleInject initializes nextDeadline at construction time instead of preStart [pekko]
He-Pin opened a new issue, #3105:
URL: https://github.com/apache/pekko/issues/3105
### Motivation
`IdleInject` initializes `nextDeadline` at `GraphStageLogic` construction time (`System.nanoTime + timeout.toNanos`), not in `preStart()` or on first `onPull()`. If materialization takes longer than the configured timeout, the first pull triggers an immediate idle element injection even though no actual idle period has occurred.
### Current behavior
`Timers.scala:241-249`:
```scala
override def createLogic(inheritedAttributes: Attributes): GraphStageLogic =
new TimerGraphStageLogic(shape) with StageLogging with InHandler with OutHandler {
private var nextDeadline: Long = System.nanoTime + timeout.toNanos // Set at construction
...
override def preStart(): Unit = pull(in) // Does not update deadline
```
### Proposed fix
Move `nextDeadline` initialization to `preStart()`:
```scala
private var nextDeadline: Long = 0L
override def preStart(): Unit = {
nextDeadline = System.nanoTime + timeout.toNanos
pull(in)
}
```
### References
- Inspired by Akka.NET [#7881](https://github.com/akkadotnet/akka.net/pull/7881)
--
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: notifications-unsubscribe@pekko.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [I] IdleInject initializes nextDeadline at construction time instead of preStart [pekko]
Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin closed issue #3105: IdleInject initializes nextDeadline at construction time instead of preStart
URL: https://github.com/apache/pekko/issues/3105
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [I] IdleInject initializes nextDeadline at construction time instead of preStart [pekko]
Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin closed issue #3105: IdleInject initializes nextDeadline at construction time instead of preStart
URL: https://github.com/apache/pekko/issues/3105
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org