[ 
https://issues.apache.org/jira/browse/FLINK-13063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16878497#comment-16878497
 ] 

Alex edited comment on FLINK-13063 at 7/4/19 9:40 AM:
------------------------------------------------------

I have encountered another issue with {{AsyncWaitOperator}} and how it 
interferes with checkpoints:

if the async function finishes some {{ResultFuture}} s with exception, some 
elements may be passed/emitted to downstream task(s) more than once.

An example test Flink job, may look like:
{code:java}
Source (1) -> AsyncOperator (1) -> Map (1) -> Sink (1)
{code}
I've created an example Flink job (hopefully properly implementing exactly-once 
source and sink, and state management) in 
[https://github.com/1u0/flink/blob/bug-async-function-more-than-once/flink-streaming-java/src/test/java/org/apache/flink/MyTestIT.java].
 In this test job, the operator after the {{AsyncFunction}} just adds counter 
of seen events. In a test run, it's possible to see some committed events more 
than once with different counter values.


was (Author: 1u0):
I have encountered another issue with {{AsyncWaitOperator}} and how it 
interferes with checkpoints:

if the async function finishes some {{ResultFuture}}s with exception, some 
elements may be passed/emitted to downstream task(s) more than once.

An example test Flink job, may look like:

{code:java}
Source (1) -> AsyncOperator (1) -> Map (1) -> Sink (1)
{code}

I've created an example Flink job (hopefully properly implementing exactly-once 
source and sink, and state management) in 
https://github.com/1u0/flink/blob/bug-async-function-more-than-once/flink-streaming-java/src/test/java/org/apache/flink/MyTestIT.java.
 In this test job, the operator after the {{AsyncFunction}} just adds counter 
of seen events. In a test run, it's possible to see some committed events more 
than once with different counter values.

> AsyncWaitOperator shouldn't be releasing checkpointingLock
> ----------------------------------------------------------
>
>                 Key: FLINK-13063
>                 URL: https://issues.apache.org/jira/browse/FLINK-13063
>             Project: Flink
>          Issue Type: Bug
>          Components: API / DataStream
>    Affects Versions: 1.6.4, 1.7.2, 1.8.1, 1.9.0
>            Reporter: Piotr Nowojski
>            Assignee: Piotr Nowojski
>            Priority: Blocker
>             Fix For: 1.9.0
>
>
> 1.
> For the following setup of chained operators:
> {noformat}
> SourceOperator -> FlatMap -> AsyncOperator{noformat}
> Lets assume that input buffer of {{AsyncOperator}} is full. We start 
> processing a record from the {{SourceOperator}}, we pass it to the 
> {{FlatMap}}, which fan it out (multiplies it 10 times). First multiplied 
> record reaches {{AsyncOperator}} and is special treated (stored in 
> {{AsyncWaitOperator#pendingStreamElementQueueEntry}} ) and then 
> {{AsyncWaitOperator}} waits (and releases) on the checkpoint lock (in 
> {{AsyncWaitOperator#addAsyncBufferEntry}} . If a checkpoint is triggered now, 
> both {{SourceOperator}} and {{FlatMap}} will be checkpointed assumed that all 
> of those 10 multiplied records were processed, which is not true. Only the 
> first one is checkpointed by the {{AsyncWatiOperator}}. Remaining 9 are not. 
> So if we ever restore state from this checkpoint, we have lost those 9 
> records.
> 2.
> Similar issue (I think previously known) can happen if for example some 
> upstream operator to the {{AsyncOperator}} fires a processing time timer, 
> that emits some data. But in that case, 
> {{AsyncWaitOperator#pendingStreamElementQueueEntry}} is being overwritten.
> 3.
> If upstream operator has the following pseudo code:
> {code:java}
> stateA = true
> output.collect(x)
> stateB = true{code}
> one would assume that stateA and stateB access/writes will be atomic from the 
> perspective of the checkpoints. But again, because {{AsyncWaitOperator}} 
> releases the checkpoint lock, they will not be.
> CC [~aljoscha] [~StephanEwen] [~srichter]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to