plugins icon indicating copy to clipboard operation
plugins copied to clipboard

summary.py: cannot add item to database

Open laanwj opened this issue 3 years ago • 2 comments

Just got the following error in my log related to summary.py:

2022-05-16T09:25:55.337Z UNUSUAL plugin-summary.py: [PeerThread] cannot add item to database

This was printed on stderr:

HASH: Out of overflow pages.  Increase page size

~~The plugin is still working but some information must have gotten lost.~~ (no, it isn't, see next post)

I'm fairly sure this is an error with shelve (lots of hits on the internet), or more specifically, the dbm database it choses. FWIW:

>>> dbm.whichdb('summary.dat')
'dbm.ndbm'

There are tons of known issues with dbm, it's a very primitive database, that randomly breaks then requires manual tuning of parameters considered unacceptable nowadays (some discussion here). I think it would make sense to switch to sqlite3 (possibly through sqlitedict, a drop-in replacement).

laanwj avatar May 17 '22 08:05 laanwj

I'm not sure if it's the same issue, but the summary plugin completely refuses to load now:

2022-05-17T19:22:13.394Z INFO    plugin-summary.py: Killing plugin: exited before replying to init

No further errors in the log.

Edit: yes, it seems related. It crashes on a simple database lookup:

    if 'peerstate' not in plugin.persist:

Edit.2: no, it gets past the lookup. What it crashes on is:

        plugin.persist['peerstate'] = {}
        plugin.persist['availcount'] = 0

Manually reproducible:

>>> import shelve
>>> db = shelve.open('summary.dat', writeback=True)
>>> db['peerstate']={}
Segmentation fault

laanwj avatar May 18 '22 08:05 laanwj

i observed very excessive logging of this cannot add item to database line and had to stop the plugin

dont understand it cause the rest of lightningd worked fine, adding things to its db.

did not figure how to re-produce except for listing the summary until it starts logging

x3nb63 avatar Feb 24 '23 11:02 x3nb63