Efrat Levitan created FLINK-41682:
-------------------------------------

             Summary: JobManager crash on startup after a partial job cleanup 
in HA cluster
                 Key: FLINK-41682
                 URL: https://issues.apache.org/jira/browse/FLINK-41682
             Project: Flink
          Issue Type: Bug
          Components: Runtime / Coordination
            Reporter: Efrat Levitan


While working on another ticket I got a dispatcher failure on startup, 
reproducing in the following scenario:
 # A job is submitted to an HA session cluster and classified as a 
SingleJobApplication
 # The job enters a terminal state for any reason
 # The dispatcher creates a dirty JobResultStore entry for it
 # Leadership change before the dispatcher could proceed to create the 
ApplicationResultStore entry
 # On the new dispatcher startup, it sees a dirty jobResultStore entry not 
mapped to an applicationResult, and crashes on 
[checkState(recoveredDirtyJobResultsByApplicationId.isEmpty())|https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java#L500]

 Test failure:

 
{code:java}
[ERROR] 
DispatcherCleanupITCase.testCleanupAfterLeadershipChangeBeforeApplicationResultWasWritten
 -- Time elapsed: 0.514 s <<< FAILURE!
java.lang.AssertionError:
[The recovered Dispatcher starts although the application has no result entry.]
Expecting code not to raise a throwable but caught
  "java.util.concurrent.CompletionException: java.lang.IllegalStateException
        at 
java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:413)
        at 
java.util.concurrent.CompletableFuture.join(CompletableFuture.java:2118)
        at 
org.apache.flink.runtime.dispatcher.TestingDispatcher.waitUntilStarted(TestingDispatcher.java:178)
        at 
org.apache.flink.runtime.dispatcher.DispatcherCleanupITCase.testCleanupAfterLeadershipChangeBeforeApplicationResultWasWritten(DispatcherCleanupITCase.java:418)
        ...
Caused by: java.lang.IllegalStateException
        at 
org.apache.flink.util.Preconditions.checkState(Preconditions.java:177)
        at 
org.apache.flink.runtime.dispatcher.Dispatcher.onStart(Dispatcher.java:500)
        at 
org.apache.flink.runtime.dispatcher.TestingDispatcher.onStart(TestingDispatcher.java:143)
        at 
org.apache.flink.runtime.rpc.RpcEndpoint.internalCallOnStart(RpcEndpoint.java:214)
        at 
org.apache.flink.runtime.rpc.pekko.PekkoRpcActor$StoppedState.start(PekkoRpcActor.java:626)
        at 
org.apache.flink.runtime.rpc.pekko.PekkoRpcActor.handleControlMessage(PekkoRpcActor.java:197)
{code}
Suggested solution:

 

Tolerate the case on dispatcher startup by creating a SingleJobApplication out 
of the orphaned jobResult (same as we do during a single job submission)



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to