Skip to content

WorkflowChangedException when migrating old running workflow which use signal/channel (0.13.2) to last version 0.16.4 #277

@alermant

Description

@alermant

Hello,

We are updating our infinitic version from 0.13.2 to 0.16.4, and during our test migration test we had WorkflowChangedException for our running workflow.

How to reproduce:

  • Start the workflow
  • Stop the workflow app (0.13.2)
  • Send a signal using the channel
  • Start the workflow app (0.16.4)

Here is a sample of the Workflow (same code for both versions):

class JourneyEngineImpl_16 : Workflow(), JourneyEngine {
    @Ignore 
    private var exitConditionChannel: Deferred<out SpecificRecordBase>? = null
    
    private fun channelExitCondition(): Deferred<out SpecificRecordBase>? = channel.receive(klass = JourneyExit::class.java, limit = 1)
    
    override val channel = channel<SpecificRecordBase>()

    override fun start() {
        // do stuff
        exitConditionChannel = channelExitCondition()
        // do stuff

        val result = when (exitConditionChannel) {
            null -> timer(duration).await()
            else -> (timer(duration) or (exitConditionChannel!!)).await()
        }
        // do stuff
   }
}
  • Error:
Workflow 01946e65-5014-7196-bf5c-c83220d176e3: past and new steps are different
pastStep = PastStep(stepPosition=12, step=Or(steps=[Id(commandId=01946e65-50c3-7ce8-a594-97e0b28193fd, awaitIndex=0)]), stepHash=510d2ecc7c213402e6f19bc6e8193c13, workflowTaskIndexAtStart=2, propertiesNameHashAtTermination={minimumDurationOfWorkflow=05b7a23b204c6bb9cc0f19626935c32c, running=b326b5062b2f0e69046810717534cb09, triggerInstanceWkf=a4419a2825dc21207a369351bad3b4a1, workflowStartedAt=dc909ec05e740b2d9fcab4ddef853d7b, context=99914b932bd37a50b983c5e7c90ae93b, stepsWkf=62e457112f957e27ab3d97a8396307b5, exitConditionChannel=1be465c2683db3752c80725c9aa863f6, journeyMetaDataWkf=b14dd64da78db1ec6549bf975c12a8f7, userWkf=e62365a0575953dfedc41563847d08e7, exitConditionReceived=68934a3e9455fa72420237eb05902327}, workflowTaskIndexAtTermination=3)
newStep = NewStep(stepId=01946e70-df7f-7bbf-b801-3762ae3cf4ff, step=Or(steps=[Id(commandId=01946e65-50c3-7fc1-9418-5ec2464be407, awaitIndex=0), Id(commandId=01946e65-50c3-7ce8-a594-97e0b28193fd, awaitIndex=0)]), stepPosition=12)
  • Stacktrace:
io.infinitic.exceptions.workflows.WorkflowChangedException: Workflow "com.splio.journey.commons.engine.workflow.JourneyEngine" has been updated since its launch (detected at position 12 in start).
You can either kill this instance or restore the workflow definition to be able to resume it
	at io.infinitic.workflows.workflowTask.WorkflowDispatcherImpl.getSimilarPastStep(WorkflowDispatcherImpl.kt:522)
	at io.infinitic.workflows.workflowTask.WorkflowDispatcherImpl.await(WorkflowDispatcherImpl.kt:181)
	at io.infinitic.workflows.Deferred.await(Deferred.kt:53)
	at com.splio.journey.workflow.engine.JourneyEngineImpl_16.executeTimer(JourneyEngineImpl_16.kt:547) // this is the line corresponding to the (timer(duration) or (exitConditionChannel!!)).await()
	at com.splio.journey.workflow.engine.JourneyEngineImpl_16.runWait$lambda$49(JourneyEngineImpl_16.kt:491)
	at com.splio.journey.workflow.engine.JourneyEngineImpl_16.englobeStep(JourneyEngineImpl_16.kt:571)
	at com.splio.journey.workflow.engine.JourneyEngineImpl_16.runStep(JourneyEngineImpl_16.kt:305)
	at com.splio.journey.workflow.engine.JourneyEngineImpl_16.start(JourneyEngineImpl_16.kt:172)
	at jdk.internal.reflect.GeneratedMethodAccessor144.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at io.infinitic.workflows.workflowTask.WorkflowTaskImpl.handle(WorkflowTaskImpl.kt:83)
	at jdk.internal.reflect.GeneratedMethodAccessor145.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at io.infinitic.tasks.executor.TaskExecutor$executeWithTimeout$2$1.invokeSuspend(TaskExecutor.kt:297)
	at io.infinitic.tasks.executor.TaskExecutor$executeWithTimeout$2$1.invoke(TaskExecutor.kt)
	at io.infinitic.tasks.executor.TaskExecutor$executeWithTimeout$2$1.invoke(TaskExecutor.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:61)
	at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:261)
	at io.infinitic.tasks.executor.TaskExecutor$executeWithTimeout$2.invokeSuspend(TaskExecutor.kt:295)
	at io.infinitic.tasks.executor.TaskExecutor$executeWithTimeout$2.invoke(TaskExecutor.kt)
	at io.infinitic.tasks.executor.TaskExecutor$executeWithTimeout$2.invoke(TaskExecutor.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturnIgnoreTimeout(Undispatched.kt:72)
	at kotlinx.coroutines.TimeoutKt.setupTimeout(Timeout.kt:148)
	at kotlinx.coroutines.TimeoutKt.withTimeout(Timeout.kt:43)
	at io.infinitic.tasks.executor.TaskExecutor.executeWithTimeout-BWLJW6A(TaskExecutor.kt:294)
	at io.infinitic.tasks.executor.TaskExecutor.process(TaskExecutor.kt:177)
	at io.infinitic.tasks.executor.TaskExecutor.access$process(TaskExecutor.kt:82)
	at io.infinitic.tasks.executor.TaskExecutor$process$2.invokeSuspend(TaskExecutor.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702)

Do you know what cause this ?

Thanks.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions