Failed to process workflow task.%!(EXTRA string=Namespace, string=default, string=TaskQueue, string=niko-worker, string=WorkerID, string=6@9631965fc1f2@, string=WorkflowType, string=ProcessOrder, string=WorkflowID, string=niko-order-1100679853, string=RunID, string=f6aaffcb-a2eb-4bae-9a59-b0192e46f560, string=Error, *serviceerror.ResourceExhausted=grpc: received message larger than max (6776550 vs. 4194304))
We also can see the same error, when we scroll down in the Web UI for the history of that workflow :
Looking into this, i believe the issue is not in the 60 parallel activities, but rather in the signals listener go-routine.
The listener is in an infinite loop waiting for signals to process. For each signal, it will eval changes to a struct and trigger an activity that we call “Upsert” to send the updated version of that struct to an external API. This activity receives the struct as argument.
Created a sample code that simulate this in my local env
1 - add a go routine with a listener to a Signal channel and loops forever. Added a WaitGroup to prevent Main Workflow from completing
2 - Signal listener handler executes an activity passing a bigger struct ( ex : 100 kb ) as argument.
3 - The Activity return nil
Script a loop to send 500 signals. After some of the signals are sent, the worker suddenly stops processing the events.
The logic solution to this is to stop passing the 100kb as arg to the Activity. The issue is that in our use case, we really need to send the struct to the Activity. Another approach would be to compress the arg, but again if the history of events grows, we will have issues again.
@maxim glad to send the sample if needed. ( Can’t attach here )
I’m confused about issue you are having. Are you saying that the large gRPC payload is not an issue anymore?
(500 signals + 500 activities) * 100kb = 100mb
which is indeed exceeds the history limit.
In your case I would recommend calling continue as new every 50-100 signals. This way the history size will be bounded and you can process an unlimited number of signals keeping the 100k argument size.