dapr / quickstarts

Dapr quickstart code samples and tutorials showcasing core Dapr capabilities
Apache License 2.0
1.02k stars 517 forks source link

order processor workflow failed in kubernete environment #806

Closed gongxh13 closed 1 day ago

gongxh13 commented 1 year ago

Ask your question here

Why order processor workflow failed in kubernete environment? I follow this https://github.com/dapr/quickstarts/tree/master/workflows/csharp/sdk quickstart, package this code to docker image, and then deploy it in k8s environment, but I failed to start workflow. I has deploy redis component and install redis, demo can see here https://github.com/gongxh13/openfunction-demo/tree/main/dapr/net/workflow Below is daprd error log

time="2023-03-09T12:02:33.822053378Z" level=warning msg="unable to establish work item stream at this time: failed to auto-start the workflow engine: failed to register workflow actor dapr.internal.wfengine.workflow: unable to register internal actor 'dapr.internal.wfengine.workflow': actor state store does not exist, or does not support transactions which are required to save state - please see https://docs.dapr.io/operations/components/setup-state-store/supported-state-stores/" app_id=workflow-order-processor instance=workflow-order-processor-6f78dfd57-g7md7 scope=dapr.runtime.wfengine type=log ver=1.10.2

And below is workllow log

info: Microsoft.DurableTask[1]
      Durable Task worker is connecting to sidecar at localhost:50001.
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /app
Starting workflow 3e243c17 purchasing 10 Cars
info: Microsoft.DurableTask.Client.Grpc.GrpcDurableTaskClient[40]
      Scheduling new OrderProcessingWorkflow orchestration with instance ID '3e243c17' and 47 bytes of input data.
info: Microsoft.DurableTask[4]
      Sidecar work-item streaming connection established.
info: Microsoft.DurableTask[3]
      The sidecar at address localhost:50001 is unavailable. Will continue retrying.
info: Microsoft.DurableTask[4]
      Sidecar work-item streaming connection established.
info: Microsoft.DurableTask[3]
      The sidecar at address localhost:50001 is unavailable. Will continue retrying.
Unhandled exception. Grpc.Core.RpcException: Status(StatusCode="Unknown", Detail="error finding address for actor type dapr.internal.wfengine.workflow with id 3e243c17")
   at Microsoft.DurableTask.Client.Grpc.GrpcDurableTaskClient.ScheduleNewOrchestrationInstanceAsync(TaskName orchestratorName, Object input, StartOrchestrationOptions options, CancellationToken cancellation)
   at Program.<Main>$(String[] args) in /src/Program.cs:line 53
   at Program.<Main>(String[] args)
gongxh13 commented 1 year ago

When I add the follow text in redis.yaml component, it work well on my linux k8s

  - name: actorStateStore  # Optional. default: false
    value : true

my final redis.yaml is


apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: statestore
spec:
  type: state.redis
  version: v1
  metadata:
  # These settings will work out of the box if you use `helm install
  # bitnami/redis`.  If you have your own setup, replace
  # `redis-master:6379` with your own Redis master address, and the
  # Redis password with your own Secret's name. For more information,
  # see https://docs.dapr.io/operations/components/component-secrets .
  - name: redisHost
    value: redis-master:6379
  - name: redisPassword
    secretKeyRef:
      name: redis
      key: redis-password
  - name: actorStateStore  # Optional. default: false
    value : true
auth:
  secretStore: kubernetes

But on my mac minikube, it has another error as

Unhandled exception. System.IO.IOException: Function not implemented
   at System.IO.FileSystemWatcher.StartRaisingEvents()
   at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed()
   at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value)
   at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher()
   at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter)
   at Microsoft.Extensions.FileProviders.PhysicalFileProvider.Watch(String filter)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.<.ctor>b__1_0()
   at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func`1 changeTokenProducer, Action changeTokenConsumer)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider..ctor(FileConfigurationSource source)
   at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder)
   at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
   at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at Program.<Main>$(String[] args) in /src/Program.cs:line 30
   at Program.<Main>(String[] args)
rabollin commented 10 months ago

/assign

joebowbeer commented 1 week ago

mac minikube missing FileSystemWatcher issue is the following?

https://github.com/Azure/azure-functions-host/issues/8666

paulyuk commented 1 day ago

Hi - this quickstart was not optimized for k8s ever. However I think your approach to apply redis is a good one. See @joebowbeer's suggetion for minikube.