You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to the current way of handling Rollouts creation, the RolloutScheduler calls JpaRolloutManagement::handleRollouts which simply iterates over all active Rollouts of the current tenant
The problem happens if an exception is thrown inside the executeFittingHandler() call. The forEach loop is then broken, and any subsequent Rollouts that are in an active state (CREATING, DELETING, STARTING, READY, or RUNNING) will not be handled. This is because the runInNewTransaction() still runs on the same (main) thread
To reproduce:
@MockprivateTransactionCallback<String> problematicCallback;
@AutowiredprivatePlatformTransactionManagertxManager;
@Beforepublicvoidsetup() {
when(problematicCallback.doInTransaction(any()))
.thenThrow(newRuntimeException("oops"))
.thenReturn("success");
}
@Testpublicvoidtest() {
try {
IntStream.range(0, 3)
.mapToObj(String::valueOf)
.forEach(rolloutId -> {
DeploymentHelper.runInNewTransaction(txManager, rolloutId, problematicCallback);
fail("Execution should not reach here");
});
} catch (RuntimeExceptione) {
// expected
}
// invoked only once because the loop was brokenverify(txManager, times(1)).commit(any());
}
We should instead make sure that any Rollout handling is executed in a try-catch block, so that we don't block any subsequent Rollouts from being handled
Due to the current way of handling Rollouts creation, the
RolloutScheduler
callsJpaRolloutManagement::handleRollouts
which simply iterates over all active Rollouts of the current tenantThe problem happens if an exception is thrown inside the
executeFittingHandler()
call. TheforEach
loop is then broken, and any subsequent Rollouts that are in an active state (CREATING, DELETING, STARTING, READY, or RUNNING
) will not be handled. This is because therunInNewTransaction()
still runs on the same (main) threadTo reproduce:
We should instead make sure that any Rollout handling is executed in a try-catch block, so that we don't block any subsequent Rollouts from being handled
The text was updated successfully, but these errors were encountered: