unltdnetworx / ioBroker.pi-hole

Adapter for cotrolling pi-hole in ioBroker smarthome
MIT License
13 stars 5 forks source link

Te Adapters floods the DB with new states with no reason #20

Closed MrDrache333 closed 3 years ago

MrDrache333 commented 3 years ago

Describe the bug
The Adapter creates Thousands of states in the DB with absolut rubbish.

To Reproduce
I just configured the Adapter to watch my two Pi-Holes. Everything works fine until my iobroker admin-Interface starts suddenly to become slower and slower

Screenshots & Logfiles

host.ioBroker Counted 2 instances of pi-hole
host.ioBroker Counted 1 meta of pi-hole
host.ioBroker Counted 1 adapter for pi-hole
host.ioBroker Counted 44 channels of pi-hole
host.ioBroker Counted 80417 states of pi-hole
host.ioBroker Counted 29 states of system.adapter.pi-hole
host.ioBroker Counted 80413 states (io.pi-hole.*) from states
host.ioBroker Counted 24 states (system.adapter.pi-hole.*) from states

Versions:

unltdnetworx commented 3 years ago

Hello Keno, I can not confirm this issue in my installation. How many seconds did you enter in the admin interface of the adapter to pull new values?

Where did you get the logs from? In my installation a lot of adapters are spamming the events log, too. This log provides each change of states and objects. So every 60 seconds (standard settings) for every state of the pi-hole adapter.

MrDrache333 commented 3 years ago

This was the deinstallation Log. The Maul deinstallation would take round about 12 Hours so I decided to copy the objects and states.json to my Mac and edit them manually to remove those entries. After that the DB was "only" 4MB left in size compared to 30MB. After the manual removing I could relogin to the admin-Adapter very quick and deinstalled the Adapter within the Admin interface to remove some left entries in the DB.

The waiting time to enter the admin Interface was near infinite. I left the tab open for round about 15 Minutes without any result. Only saw the loading bar.

I will read out my backup and send some entries out of the states/objects.json in a few minutes

MrDrache333 commented 3 years ago

Here are some states created by the pihole adapter. Those were created round about 80000 times in one file

{"val":"�","ack":true,"ts":1599955452725,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287265},"pi-hole.0.version.928":{"val":"$","ack":true,"ts":1599955452726,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287266},"pi-hole.0.version.929":{"val":"Q","ack":true,"ts":1599955452726,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287266},"pi-hole.0.version.930":{"val":"\u0018","ack":true,"ts":1599955452726,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287266},"pi-hole.0.version.931":{"val":"�","ack":true,"ts":1599955452726,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287267},"pi-hole.0.version.932":{"val":"\u0015","ack":true,"ts":1599955452726,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287267},"pi-hole.0.version.933":{"val":"�","ack":true,"ts":1599955452727,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287267},"pi-hole.0.version.934":{"val":"�","ack":true,"ts":1599955452727,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287267},"pi-hole.0.version.935":{"val":"!","ack":true,"ts":1599955452727,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287268},"pi-hole.0.version.936":{"val":"�","ack":true,"ts":1599955452727,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287268},"pi-hole.0.version.937":{"val":"g","ack":true,"ts":1599955452728,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287268},"pi-hole.0.version.938":{"val":"q","ack":true,"ts":1599955452728,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287268},"pi-hole.0.version.939":{"val":"�","ack":true,"ts":1599955452728,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287269},"pi-hole.0.version.940":{"val":"_","ack":true,"ts":1599955452728,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287269},"pi-hole.0.version.941":{"val":"�","ack":true,"ts":1599955452728,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287270},"pi-hole.0.version.942":{"val":"w","ack":true,"ts":1599955452729,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287270},"pi-hole.0.version.943":{"val":"�","ack":true,"ts":1599955452729,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287270},"pi-hole.0.version.944":{"val":"`","ack":true,"ts":1599955452729,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287270},"pi-hole.0.version.945":{"val":"�","ack":true,"ts":1599955452729,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287271},"pi-hole.0.version.946":{"val":"l","ack":true,"ts":1599955452729,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287271},"pi-hole.0.version.947":{"val":"�","ack":true,"ts":1599955452730,"q":0,"from":"system.adapter.pi-hole.0","user":"system.user.admin","lc":1588418287271},"pi-hole.0.version.948":{"val":"\u0001","ack":true,"ts":1599955452730,"q":0,"from":"system.adapter.pi-
unltdnetworx commented 3 years ago

Did I get you right? These logs are coming from a database adapter?

If so, you should only log the values on change, not on update. And maybe reduce the values to log to only the necessary ones.