[ https://issues.apache.org/jira/browse/FLINK-9857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16545286#comment-16545286 ]
Aljoscha Krettek commented on FLINK-9857: ----------------------------------------- On a side note: even if we change this off-by-one bug, I think there can still be races because current processing time is queried using System.currentTimeMillis() and we set timers using a ScheduledThreadPoolExecutor (currently). If there's any race between those two you can also get weird results. For these reasons, I would always suggest to go with event time or ingestion time, but I think the latter is currently not possible with the Table API/SQL. > Processing-time timers fire too early > ------------------------------------- > > Key: FLINK-9857 > URL: https://issues.apache.org/jira/browse/FLINK-9857 > Project: Flink > Issue Type: Bug > Components: DataStream API > Affects Versions: 1.3.4, 1.4.2, 1.5.1, 1.6.0 > Reporter: Aljoscha Krettek > Assignee: Aljoscha Krettek > Priority: Blocker > Fix For: 1.5.2, 1.6.0 > > > The firing of processing-time timers is off by one. This leads to problems in > edge cases, as discovered [here (mailing > list)|https://lists.apache.org/thread.html/e49748fa5fa1c9217b9dfb65eea7a37af1f2895c769528e77a1a93fa@%3Cuser.flink.apache.org%3E] > when elements arrive at the timestamp that is the end of the window. > The problem is [here > (github)|https://github.com/apache/flink/blob/79b38f8f9a79b917d525842cf46087c5b8c40f3d/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/HeapInternalTimerService.java#L231]. > For event-time, we fire timers when the watermark is >= the timestamp, this > is correct because a watermark T says that we will not see elements with a > timestamp smaller or equal to T. For processing time, a time of T does not > say that we won't see an element with timestamp T, which makes > processing-time timers fire one ms too early. > I think we can fix it by turning that {{<=}} into a {{<}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005)