dapr icon indicating copy to clipboard operation
dapr copied to clipboard

Dapr Actors: "Could not find active reminder with key" error in the sidecar container

Open Andemki opened this issue 1 year ago • 1 comments

In what area(s)?

/area runtime

What version of Dapr?

1.11.4

Expected Behavior

No records about reminder errors in the daprd sidecar container's logs

Actual Behavior

We use Dapr actors in our .Net C# application. Actor instances periodically receive a request, process this request and then register a reminder. The reminder's call back method ReceiveReminderAsync checks if there were any requests to the actor within 10 minutes and if there were no such requests, this method does some cleanup logic and unregister the reminder to allow the actor to switch to the idle state. Please see an example of the code below. We run our applications in Kubernetes. And when I check the "daprd" container logs, I see a lot of error messages:

time="2024-10-09T08:32:37.012106918Z" level=error msg="Could not find active reminder with key: %sVehicleActor||Ho414_5885||vehiclestatusreminder" app_id=vehicleactor instance=vehicleactor-585d459fcd-2n466 scope=dapr.runtime.actor.reminders type=log ver=1.14.4

Could you please help us to resolve this issue?

        public async Task PostLocationAsync(TaipMessage taipMessage, CancellationToken ct)
        {
            try
            {
                await _vehicleService.PostLocation(taipMessage, ct);
                await RegisterReminderAsync(VehicleStatusReminderKey, null, VehicleStatusReminderTimeout, VehicleStatusReminderTimeout);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex, $"{Id.GetId()}: ERROR. {ex.Message}");
            }
        }

        public async Task ReceiveReminderAsync(string reminderName, byte[] state, TimeSpan dueTime, TimeSpan period)
        {
            try
            {
                if (!reminderName.Equals(VehicleStatusReminderKey))
                    return;

                if (!await _vehicleService.EnsureVehicleOnline(CancellationToken.None))
                {
                    var reminder = await GetReminderAsync(VehicleStatusReminderKey);
                    if (reminder != null)
                        await UnregisterReminderAsync(reminder);
                }
            }
            catch(Exception ex)
            {
                Logger.LogError(ex, $"{Id.GetId()}: ReceiveReminderAsync Error: {ex.Message}");
            }
        }

Steps to Reproduce the Problem

  1. Register a reminder when an actor's instance receives a new request
  2. Unregister reminder in the ReceiveReminderAsync method

Andemki avatar Oct 09 '24 09:10 Andemki

I can confirm I am seeing this in 1.14.4.

If I un-register a reminder from outside of the reminder call-back, no error is generated. If I un-register a reminder from inside the ReceiveReminderAsync callback, I get a nuisance error log in the daprd sidecar.

2024-10-15T15:07:36-04:00 time="2024-10-15T19:07:36.17639473Z" level=error msg="Could not find active reminder with key: %sactor-type||actor-id||ReminderName" app_id=actor-microservice instance=actor-microservice-6794c548d5-kqb4t scope=dapr.runtime.actor.reminders type=log ver=1.14.4

It does appear that the reminder is correctly unregisterd, as it does not fire again.

MattCosturos avatar Oct 15 '24 19:10 MattCosturos

I'm having same error.

SDK version 1.13.6 .net nugets version: 1.13.1 application is working locally, windows 10.

time="2024-11-12T13:27:20.0873767+01:00" level=error msg="Could not find active reminder with key: %sAppXXXXXXXXXXX-dev-v1|XXXXXXXXXXXX||XXXXXXXXXXXXXXXXXXXXXXXX" app_id=apps-session instance=XXX-XXXXXXX scope=dapr.runtime.actor.reminders type=log ver=1.13.6

Reminder works, code is executed and just after this error pops up in the logs.

What worries me in that message is also %sAppXXXXX, actor name starts with App, what is that %s I have no idea. Code worked perfectly before upgrade from 1.11.6 (nugets 1.11)

anna-jankowska avatar Nov 12 '24 12:11 anna-jankowska

I run into this same issue on 1.14.0

landonnewberry avatar Nov 22 '24 21:11 landonnewberry

This issue has been automatically marked as stale because it has not had activity in the last 60 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

dapr-bot avatar Jan 21 '25 21:01 dapr-bot

This issue has been automatically closed because it has not had activity in the last 67 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. Thank you for your contributions.

dapr-bot avatar Jan 28 '25 21:01 dapr-bot