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


   A quick question in the closing behavior of the Kafka Enumerator.
   The code here is handling the closing in a separate thread, but blocks for a 
timeout. I am not sure if the following situations have been defined well 
before:
   
     - If I read the code correctly, the closing of enumerators is synchronous 
and does not happen in the enumerator thread of the `SourceCoordinator`. That 
means any blocking operation during closing actually blocks the scheduler 
mailbox. I think we need to avoid that at all cost, this makes the JM unstable 
otherwise.
   
     - If the closing actually times out or throws an exception, all we see is 
a log message. There may very well be a hanging thread on the Job Manager and 
some still active resources. That can easily cause trouble later, especially if 
it happens multiple times.
   
       The TMs hence don't do such magic. They simply try to exit (waiting for 
the executing thread) and do a process kill / restart when the thread does not 
exit.
   
   I am wondering if we need the following changes:
     - Make closing asynchronous. The `close()` call in the `SourceCoordinator` 
closes the context directly (fail fast) and then clears all pending actions 
from the enumerator thread executor and only schedules the `enumerator.close()` 
call into that executor.
     - We have then a very generic way to say "if not complete in 10s, escalate 
as exception" which would lead to a JM restart. Then we would avoid resource 
leaks.
   


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to