How to debug error in TestWorkflowEnvironment

I’m running a test that uses the TestWorkflowEnvironment and get this error in the logs.

{"@timestamp":"2020-08-19T09:46:58.004-07:00","@version":"1","message":"Retrying after failure","logger_name":"com.uber.cadence.internal.common.Retryer","thread_name":"ServiceDispatcher-worker-115 @coroutine#4","level":"WARN","level_value":30000,"stack_trace":"org.apache.thrift.TException: Rpc error:<ErrorResponse id=5 errorType=UnexpectedError message=invalid character '\\x00' looking for beginning of value>\n\tat com.uber.cadence.serviceclient.WorkflowServiceTChannel.throwOnRpcError(WorkflowServiceTChannel.java:314)\n\tat com.uber.cadence.serviceclient.WorkflowServiceTChannel.doRemoteCall(WorkflowServiceTChannel.java:279)\n\tat com.uber.cadence.serviceclient.WorkflowServiceTChannel.respondActivityTaskCompleted(WorkflowServiceTChannel.java:977)\n\tat com.uber.cadence.serviceclient.WorkflowServiceTChannel.lambda$RespondActivityTaskCompleted$17(WorkflowServiceTChannel.java:966)\n\tat com.uber.cadence.serviceclient.WorkflowServiceTChannel.lambda$measureRemoteProc$2(WorkflowServiceTChannel.java:354)\n\tat com.uber.cadence.serviceclient.WorkflowServiceTChannel.measureRemoteCall(WorkflowServiceTChannel.java:332)\n\tat com.uber.cadence.serviceclient.WorkflowServiceTChannel.measureRemoteProc(WorkflowServiceTChannel.java:351)\n\tat com.uber.cadence.serviceclient.WorkflowServiceTChannel.RespondActivityTaskCompleted(WorkflowServiceTChannel.java:964)\n\tat com.uber.cadence.internal.external.ManualActivityCompletionClientImpl.lambda$complete$0(ManualActivityCompletionClientImpl.java:96)\n\tat com.uber.cadence.internal.common.Retryer.lambda$retry$0(Retryer.java:104)\n\tat com.uber.cadence.internal.common.Retryer.retryWithResult(Retryer.java:122)\n\tat com.uber.cadence.internal.common.Retryer.retry(Retryer.java:101)\n\tat com.uber.cadence.internal.external.ManualActivityCompletionClientImpl.complete(ManualActivityCompletionClientImpl.java:94)\n\tat com.uber.cadence.internal.sync.ActivityCompletionClientImpl.complete(ActivityCompletionClientImpl.java:36)\n\tat com.doordash.payment.common.cadence.CoroutineActivity$coroutineDriver$2.invokeSuspend(CoroutineActivity.kt:63)\n\tat kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)\n\tat kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base/java.lang.Thread.run(Thread.java:834)\n"}

Can anyone provide some advice here? And more generally, what are some best ways to debug something like this?

1 Like

The stack trace of the exception is coming from the WorkflowServiceTChannel which is not part of the TestWorkflowEnvironment. My guess is that you have initialized the manual completion client with the wrong instance of the service. Use the result of TestWorkflowEnvironment.getWorkflowService() instead.

That was the exact issue. Thanks @maxim!