An alarm could not be acknowledged. It may no longer be registered

I have a button in a Vision project that runs the following script:

def ackAlarms():

	start = system.date.addHours(system.date.now(), -12)
	end = system.date.now()
	state = ['ActiveUnacked', 'ClearUnacked']
	data = system.alarm.queryJournal(startDate = start, endDate = end, state = state)
	# Create list of event IDs
	uuidList = [str(row.getId()) for row in data]
	system.alarm.acknowledge(uuidList,'ack')

system.util.invokeAsynchronous(ackAlarms)

Everything works fine and there are no errors on the client, but the gateway logs are filling up with the error: An alarm could not be acknowledged. It may no longer be registered. It is about 180 entries every time the acknowledge button is clicked.

In the forum I found suggestions to run in an Asynchornous thread, which I am already doing. Another suggestion was to restart the gateway, which had no effect.
Since everything is working fine, I'll settle for a way to just not log the error, but it seems like if an alarm is no longer registered it would not be found by the query.
Any further suggestions?

Try:

  1. Put your ackAlarms code in the project library
  2. Add a gateway message handler that simply calls the library function
  3. Swap your Vision button to use system.util.sendMessage to fire off a request

This has the same asynchronous benefit, but will actually run the alarm query and acknowledgement on the gateway, which should help minimize the risk of a data race, where the set of alarms returned in the query is different by the time the acknowledge call happens.

You may also need to check the list for duplicates - at a glance your function seems like it shouldn't be passing duplicate IDs but I don't remember alarming well enough to say that with 100% confidence.

1 Like

I had to wait until they were not running again to make the change and when I went back to the logs, I found that it was down to 8 errors instead of the 180 I was getting yesterday before making some changes. Perhaps they are clearing out slowly. I did follow through with your suggestion though. I can't say it made a difference but after pressing the button several times I am down to 7 errors per press. I didn't really think anything I did last night would have done anything. I just cleaned up the old commented out lines, for the most part.