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
Querying a workflow doesn't generate additional logs.
Actual Behavior
Querying a workflow generates additional logs.
Steps to Reproduce the Problem
I added an additional test to DirectQueryReplaysDontSpamLogWithWorkflowExecutionExceptionsTest.java to reproduce the issue.
@RulepublicSDKTestWorkflowRuletestWorkflowRule =
SDKTestWorkflowRule.newBuilder()
.setWorkflowTypes(TestWorkflowNonRetryableFlag.class, LogAndKeepRunningWorkflow.class)
.setActivityImplementations(newTestActivities.TestActivitiesImpl())
.build();
@TestpublicvoidqueriedWorkflowFailureDoesntProduceAdditionalLogsWhenWorkflowIsNotCompleted()
throwsInterruptedException {
TestWorkflows.QueryableWorkflowworkflow =
testWorkflowRule.newWorkflowStub(TestWorkflows.QueryableWorkflow.class);
WorkflowExecutionexecution = WorkflowClient.start(workflow::execute);
Thread.sleep(500);
assertEquals(
"Workflow execution exception should be logged",
1,
workflowExecuteRunnableLoggerAppender.list.size());
TestWorkflows.QueryableWorkflowqueryStub =
testWorkflowRule
.getWorkflowClient()
.newWorkflowStub(TestWorkflows.QueryableWorkflow.class, execution.getWorkflowId());
assertEquals("my-state", queryStub.getState());
assertEquals("There was only one execution.", 1, workflowCodeExecutionCount.get());
assertEquals(
"Only the original exception should be logged.",
1,
workflowExecuteRunnableLoggerAppender.list.size());
testWorkflowRule.invalidateWorkflowCache();
assertEquals("my-state", queryStub.getState());
assertEquals(
"There was two executions - one original and one full replay for query.",
2,
workflowCodeExecutionCount.get());
assertEquals(
"Only the original exception should be logged.",
1,
workflowExecuteRunnableLoggerAppender.list.size());
queryStub.mySignal("exit");
assertEquals("my-state", queryStub.getState());
assertEquals(
"There was three executions - one original and two full replays for query.",
3,
workflowCodeExecutionCount.get());
assertEquals(
"Only the original exception should be logged.",
1,
workflowExecuteRunnableLoggerAppender.list.size());
}
publicstaticclassLogAndKeepRunningWorkflowimplementsTestWorkflows.QueryableWorkflow {
privatefinalorg.slf4j.Loggerlogger;
privatefinalTestActivities.VariousTestActivitiesactivities;
privatebooleanexit;
publicLogAndKeepRunningWorkflow() {
activities =
Workflow.newActivityStub(
TestActivities.VariousTestActivities.class,
ActivityOptions.newBuilder()
.setStartToCloseTimeout(Duration.ofSeconds(10))
.setRetryOptions(RetryOptions.newBuilder().setMaximumAttempts(1).build())
.build());
logger = Workflow.getLogger("io.temporal.internal.sync.WorkflowExecutionHandler");
}
@OverridepublicStringexecute() {
workflowCodeExecutionCount.incrementAndGet();
while (true) {
try {
activities.throwIO();
} catch (ActivityFailuree) {
logger.error("Unexpected error on activity", e);
Workflow.await(() -> exit);
if (exit) {
return"exit";
}
}
}
}
@OverridepublicStringgetState() {
return"my-state";
}
@OverridepublicvoidmySignal(Stringvalue) {
exit = true;
}
}
I found that the logs are generated because replaying is being set to false here:
I saw that there were changes to those lines recently, but I've tested with 1.23.1, 1.23.2 and master and the issue is present in all of them. I first noticed the issue in production when upgrading from 1.19.1 to 1.23.1.
Specifications
Version: 1.23.1 / 1.23.2 / master
Platform: Ubuntu 22
The text was updated successfully, but these errors were encountered:
Expected Behavior
Querying a workflow doesn't generate additional logs.
Actual Behavior
Querying a workflow generates additional logs.
Steps to Reproduce the Problem
I added an additional test to
DirectQueryReplaysDontSpamLogWithWorkflowExecutionExceptionsTest.java
to reproduce the issue.I found that the logs are generated because replaying is being set to false here:
sdk-java/temporal-sdk/src/main/java/io/temporal/internal/statemachines/WorkflowStateMachines.java
Lines 456 to 462 in 5e5cf0b
I saw that there were changes to those lines recently, but I've tested with 1.23.1, 1.23.2 and master and the issue is present in all of them. I first noticed the issue in production when upgrading from 1.19.1 to 1.23.1.
Specifications
The text was updated successfully, but these errors were encountered: