cadence-workflow/cadence-web

Query feature is broken for Java workflows

sokada1221 opened this issue · 2 comments

Describe the bug
Query feature on Cadence UI is broken for Java workflows. Trailing ',' shows up for query types.

To Reproduce
Is the issue reproducible?

  • Yes

Steps to reproduce the behavior:

  1. Run Java workflow with 2 or more query methods
  2. Check the list of queries on Cadence UI

Expected behavior
Query feature to work for Java workflows as well

Screenshots
image

Additional context
N/A

Root cause:
cadence-web is getting the list of query types from the exception message.
Since message formats are different for Go SDK and Java SDK, the parsing is failing for Java exception messages.

Go exception message:

QueryFailedError{Message: unknown queryType a. KnownQueryTypes=[__stack_trace __open_sessions state2 state]}

Java exception message:

QueryFailedError{Message: java.lang.IllegalArgumentException: Unknown query type: a, knownTypes=[GreetingWorkflow::queryGreeting, GreetingWorkflow::queryGreeting2]
	at com.uber.cadence.internal.sync.SyncDecisionContext.query(SyncDecisionContext.java:545)
	at com.uber.cadence.internal.sync.WorkflowRunnable.query(WorkflowRunnable.java:69)
	at com.uber.cadence.internal.sync.SyncWorkflow.query(SyncWorkflow.java:149)
	at com.uber.cadence.internal.replay.ReplayDecider.lambda$query$f351f263$1(ReplayDecider.java:545)
	at com.uber.cadence.internal.replay.ReplayDecider.decideImpl(ReplayDecider.java:445)
	at com.uber.cadence.internal.replay.ReplayDecider.query(ReplayDecider.java:545)
	at com.uber.cadence.internal.replay.ReplayDecisionTaskHandler.processQuery(ReplayDecisionTaskHandler.java:219)
	at com.uber.cadence.internal.replay.ReplayDecisionTaskHandler.handleDecisionTaskImpl(ReplayDecisionTaskHandler.java:123)
	at com.uber.cadence.internal.replay.ReplayDecisionTaskHandler.handleDecisionTask(ReplayDecisionTaskHandler.java:86)
	at com.uber.cadence.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:257)
	at com.uber.cadence.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:229)
	at com.uber.cadence.internal.worker.PollTaskExecutor.lambda$process$0(PollTaskExecutor.java:71)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
}

Hi @sokada1221 ,

Thanks for opening a PR for this issue.
I will try to review this week.

Thanks!