StephanEwen commented on pull request #16972:
URL: https://github.com/apache/flink/pull/16972#issuecomment-914408075


   I updated the comments to this now, to clarify the concerns. I think this is 
good and I would merge it like that.
   
   ```
   During graceful shutdown (for example stopping a job with a savepoint), the 
program must
   cleanly exit the {@link #run(SourceContext)} method soon after this method 
was called. The
   Flink runtime will NOT interrupt the source thread during graceful shutdown. 
Source
   implementers must ensure that no thread interruption happens on any thread 
that emits records
   through the {@code SourceContext} from the {@link #run(SourceContext)} 
method; otherwise the
   clean shutdown may fail when threads are interrupted while processing the 
final records.
   
   Because the {@code SourceFunction} cannot easily differentiate whether the 
shutdown should
   be graceful or ungraceful, we recommend that implementers refrain from 
interrupting any
   threads that interact with the {@code SourceContext} at all. You can rely on 
the Flink
   runtime to interrupt the source thread in case of ungraceful cancellation. 
Any additionally
   spawned threads that directly emit records through the {@code SourceContext} 
should use a
   shutdown method that does not rely on thread interruption.
   ```


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


Reply via email to