alexandru commented on code in PR #4:
URL: https://github.com/apache/incubator-pekko/pull/4#discussion_r1012614433


##########
akka-stream/src/main/scala/akka/stream/impl/Timers.scala:
##########
@@ -275,11 +275,15 @@ import akka.stream.stage._
           val now = System.nanoTime()
           // Timer is reliably cancelled if a regular element arrives first. 
Scheduler rather schedules too late
           // than too early so the deadline must have passed at this time.
-          assert(
-            now - nextDeadline >= 0,

Review Comment:
   Kind of weird that this invariant doesn't hold.
   
   I understand that NTP can influence `System.nanoTime`, but I thought that 
the primary reason to use `nanoTime` is that it's guaranteed to be monotonic, 
and whenever NTP synchronization happens, the clocks simply slow down. Maybe 
I'm wrong, but if you can go back in time with `System.nanoTime`, a lot of 
functionality breaks in projects.
   
   My assumption is that this issue happens because the timer woke up *earlier* 
for some reason. It's like when you do `Object.wait(1000)` 
([link](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait(long))),
 but you're not guaranteed `1000 millis`, as it can wake up earlier, so you 
have to check, and sleep some more if needed.
   
   If the timer simply weaks up earlier (the delay isn't guaranteed), then 
there's no need for the `log.warning`, since this is a happy path. Just a 
suggestion — but warnings need to be actionable. E.g., what should the user do 
when it sees one? Should the user re-adjust some configuration (NTP maybe) or 
report a bug? In this case, I don't think there's anything the user can do.
   
   And too many warnings in those logs leads to users ignoring warnings.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to