iobroker-community-adapters / ioBroker.unifi

ioBroker.unifi is an ioBroker adapter for your UniFi network devices.
MIT License
73 stars 24 forks source link

CPU sehr hoch #724

Closed Negalein closed 4 months ago

Negalein commented 8 months ago

seit 0.6.7 startet der Adapter immer neu und die CPU schießt in die Höhe.

unifi.0 2023-12-14 16:51:11.294 error   [updateUnifiData-fetchSites site undefined] error: Cannot find view "system", stack: Error: Cannot find view "system" at ObjectsInRedisClient._getObjectView (/opt/iobroker/node_modules/@iobroker/db-objects-redis/src/lib/objects/objectsInRedisClient.ts:4317:19) at Immediate.<anonymous> (/opt/iobroker/node_modules/@iobroker/db-objects-redis/src/lib/objects/objectsInRedisClient.ts:4392:37)
unifi.0 2023-12-14 16:51:11.246 error   Cannot find view "system" for search "state" : Connection is closed.
unifi.0 2023-12-14 16:51:11.245 error   [updateUnifiData site default] error: DB closed, stack: Error: DB closed at Redis.sendCommand (/opt/iobroker/node_modules/ioredis/built/redis/index.js:636:24) at Redis.get (/opt/iobroker/node_modules/ioredis/built/commander.js:122:25) at StateRedisClient.setState (/opt/iobroker/node_modules/@iobroker/db-states-redis/src/lib/states/statesInRedisClient.ts:726:40) at Unifi._setState (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/src/lib/adapter/adapter.ts:7710:33)
unifi.0 2023-12-14 16:51:11.127 warn    get state error: Connection is closed.
unifi.0 2023-12-14 16:51:00.720 error   [updateUnifiData-fetchSites site undefined] error: DB closed, stack: Error: DB closed at close (/opt/iobroker/node_modules/ioredis/built/redis/event_handler.js:184:25) at Socket.<anonymous> (/opt/iobroker/node_modules/ioredis/built/redis/event_handler.js:151:20) at Object.onceWrapper (node:events:632:26) at Socket.emit (node:events:517:28) at Socket.emit (node:domain:489:12) at TCP.<anonymous> (node:net:350:12)
unifi.0 2023-12-14 16:50:00.727 warn    get state error: Connection is closed.
unifi.0 2023-12-14 16:49:00.540 warn    get state error: Connection is closed.
Negalein commented 8 months ago

das dauernde Neustarten des Adapter hat sich selbst behoben. Allerdings geht die CPU noch immer von ca. 15% (Adapter gestoppt) bei laufenden Adapter auf 70-75% hoch.

JS-Controller: 5.0.17 Admin: 6.12.9 Node.js: 18.19.0 NPM: 10.2.3


2023-12-18 10:03:44.080  - info: host.ioBroker "system.adapter.unifi.0" enabled
2023-12-18 10:03:44.585  - info: host.ioBroker instance system.adapter.unifi.0 started with pid 128723
2023-12-18 10:06:04.137  - info: host.ioBroker stopInstance system.adapter.unifi.0 (force=false, process=true)
2023-12-18 10:06:04.165  - info: host.ioBroker stopInstance system.adapter.unifi.0 send kill signal
2023-12-18 10:06:04.666  - warn: unifi.0 (128723) redis get unifi.0.default.clients.d0:bf:9c:df:e9:18.is_online, error - Connection is closed.
2023-12-18 10:06:04.670  - warn: unifi.0 (128723) Could not perform strict object check of state unifi.0.default.clients.d0:bf:9c:df:e9:18.is_online: DB closed
2023-12-18 10:06:04.670  - warn: unifi.0 (128723) get state error: Connection is closed.
2023-12-18 10:06:04.798  - error: unifi.0 (128723) [updateUnifiData-fetchSites site undefined] error: DB closed, stack: Error: DB closed
    at Unifi.setForeignState (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/src/lib/adapter/adapter.ts:8549:30)
2023-12-18 10:06:04.953  - info: host.ioBroker instance system.adapter.unifi.0 terminated with code 11 (ADAPTER_REQUESTED_TERMINATION)
2023-12-18 10:06:07.389  - info: host.ioBroker instance system.adapter.unifi.0 started with pid 128797
2023-12-18 10:06:07.947  - debug: unifi.0 (128797) Redis Objects: Use Redis connection: 0.0.0.0:9001
2023-12-18 10:06:08.015  - debug: unifi.0 (128797) Objects client ready ... initialize now
2023-12-18 10:06:08.016  - debug: unifi.0 (128797) Objects create System PubSub Client
2023-12-18 10:06:08.017  - debug: unifi.0 (128797) Objects create User PubSub Client
2023-12-18 10:06:08.152  - debug: unifi.0 (128797) Objects client initialize lua scripts
2023-12-18 10:06:08.159  - debug: unifi.0 (128797) Objects connected to redis: 0.0.0.0:9001
2023-12-18 10:06:08.245  - debug: unifi.0 (128797) Redis States: Use Redis connection: 0.0.0.0:9000
2023-12-18 10:06:08.306  - debug: unifi.0 (128797) States create System PubSub Client
2023-12-18 10:06:08.306  - debug: unifi.0 (128797) States create User PubSub Client
2023-12-18 10:06:08.399  - debug: unifi.0 (128797) States connected to redis: 0.0.0.0:9000
2023-12-18 10:06:08.472  - debug: unifi.0 (128797) Plugin sentry Initialize Plugin (enabled=true)
2023-12-18 10:06:08.741  - info: unifi.0 (128797) starting. Version 0.6.7 in /opt/iobroker/node_modules/iobroker.unifi, node: v18.19.0, js-controller: 5.0.17
2023-12-18 10:06:08.767  - debug: unifi.0 (128797) Schedule restart: * */4 * * *
2023-12-18 10:06:08.787  - info: unifi.0 (128797) UniFi adapter is ready
2023-12-18 10:06:08.788  - debug: unifi.0 (128797) controller = 10.0.1.151:8443
2023-12-18 10:06:08.788  - debug: unifi.0 (128797) updateInterval = 60
2023-12-18 10:06:08.788  - debug: unifi.0 (128797) Update started
2023-12-18 10:06:09.767  - debug: unifi.0 (128797) Login successful
2023-12-18 10:06:09.798  - debug: unifi.0 (128797) fetchSites: default
2023-12-18 10:06:09.804  - debug: unifi.0 (128797) Update site: default
2023-12-18 10:06:09.829  - debug: unifi.0 (128797) fetchSiteSysinfo default: 1
2023-12-18 10:06:09.905  - debug: unifi.0 (128797) fetchClients default: 42
2023-12-18 10:06:16.599  - debug: unifi.0 (128797) Search can't be optimized because wildcard not at the end, fallback to keys!: function(doc) { if (doc.type === 'state') emit(doc._id, doc) }
2023-12-18 10:06:17.340  - debug: unifi.0 (128797) fetchDevices default: 18
2023-12-18 10:06:29.221  - debug: unifi.0 (128797) fetchWlans default: 3
2023-12-18 10:06:29.368  - debug: unifi.0 (128797) fetchNetworks default: 1
2023-12-18 10:06:29.431  - debug: unifi.0 (128797) fetchHealth default: 5
2023-12-18 10:06:29.621  - debug: unifi.0 (128797) fetchVouchers default: 10
2023-12-18 10:06:30.862  - debug: unifi.0 (128797) fetchAlarms default: 1511
2023-12-18 10:07:34.787  - info: host.ioBroker "system.adapter.unifi.0" disabled
2023-12-18 10:07:34.787  - info: host.ioBroker stopInstance system.adapter.unifi.0 (force=false, process=true)
2023-12-18 10:07:35.200  - info: host.ioBroker stopInstance system.adapter.unifi.0 send kill signal
2023-12-18 10:07:35.641  - warn: unifi.0 (128797) redis mget of 47 keys, err: Connection is closed.
2023-12-18 10:07:35.656  - error: unifi.0 (128797) uncaught exception: Connection is closed.
2023-12-18 10:07:35.656  - error: unifi.0 (128797) Error: Connection is closed.
2023-12-18 10:07:35.657  - error: unifi.0 (128797) Connection is closed.
2023-12-18 10:07:35.818  - info: host.ioBroker instance system.adapter.unifi.0 terminated with code 11 (ADAPTER_REQUESTED_TERMINATION)```
mcm1957 commented 7 months ago

Könntest du mal schaun wieviele States du unter unifi.0.default.alarm.* hast? Da gabs ein Issue beim javascript wo 70000 satets existierten ...

Negalein commented 7 months ago

Könntest du mal schaun wieviele States du unter unifi.0.default.alarm.* hast?

die Alarms hab ich deaktiviert. CPU geht noch immer auf 60% hoch.

Negalein commented 4 months ago

nach längerer Beobachtungszeit hat sich das Problem erledigt. Man darf nicht alles abfragen. Nur auf das Wichtigste konzentrieren.