Repository navigation
High latency on recurringtask? #566
|
Dear All, I use BAC0 on monitoring devices (beaglebone, ubuntu 18, python 3.10) in async mode and it works very well normally. In principle I have a infinite loop that polls the bacnet device with await, every e.g. 30 seconds timed by sleep time is calculated on the time the loop actually runs: gp.heartbeat is the requested time (30 seconds) The data writer loop is setup as a asyncio task before the infinite loop, if that task crashes it restarts itself. If it helps I can post more detailed code, but I hope the general flow is clear (?) However, on some networks I get warnings with regard to the recurring tasks: 2025-09-15 13:03:14,565 - WARNING | BAC0.tasks.RecurringTask | RecurringTask | BAC0.tasks.TaskManager | High latency for Cleanup Tasks List I am not sure if this is the root cause, but on those networks I also have issues with timing of the monitoring data writes (normally written to files every 300 seconds, but then e.g. after 50 seconds or 500 seconds, indicating that the async read task crashes or has another issue, the main program does not crash). I use bacnet.readMultiple to read data from the device, I do not use auto polling. There is only one bacnet device on the network that I monitor, but there is another bacnet device that also reads/writes to the device being monitored. Is there a good way to try and trace the error or perhaps even prevent it? Thanks for any suggestions! Henk Witte |
Replies: 2 comments 1 reply
|
Ok, thanks for this report. It led me to reconsider the way I was doing this. Can you please check the develop branch and see if its better ? I've done some local tests but I'm limited in time and number of devices. There was a bug that was doubling the delay And I made the clean task async because I suspect mixing async and sync could lead to some issues. |
|
I have been testing the develop branch (version 2025.9.15) since yesterday and I do not see the High latency for Cleanup Tasks warnings anymore. So the develop branch solves this problem it seems! With regard to your other remark, running the function as a recurring task: no not at this time. The function that does the bacnet read is awaited in a main loop that the main loop then has an await asyncio.sleep. The bacnet read function retrieves data by:
And then does some processing of the bacnet values read. On other systems this works well, even with shorter repeat times. But I will look into the recurring task solution as well, preferably on a test system. The monitor_write function is defined as
with bcn_devices a class with the device data (currently only one device monitored) and write_param including the log interval |
Ok, thanks for this report. It led me to reconsider the way I was doing this. Can you please check the develop branch and see if its better ? I've done some local tests but I'm limited in time and number of devices.
There was a bug that was doubling the delay
And I made the clean task async because I suspect mixing async and sync could lead to some issues.