-
Notifications
You must be signed in to change notification settings - Fork 913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugins: db_write hook and safe shutdown, back to square one? #5859
Comments
As you can probably tell from the title, there was a some frustration: Plugin documentation wasn't updated (No more error code -5). The meager Changelog entry:
is confusing and seems to contradict In reality a plugin cannot make new RPC calls during shutdown (like lightning/lightningd/lightningd.c Lines 1210 to 1211 in 09a9673
but when the Line 2176 in 65170be
plugins can still receive the response of existing RPC calls. Anyway, please have a look at #5872. |
Below test (see this branch) shows that connectd accepts incoming connections during shutdown, circumventing any previously registered
|
By
changechance I discovered thatlightningd
's shutdown sequence has been changed again in #5577, which seems to partly revert the effects of #4897 and #4959.#4897 and #4959 where carefully crafted to guarantee that no database write can occur after plugins are shutdown, so that a backup plugin could never miss
db_write
hook calls.Most notably e7fe59b moves closing of the database back to the bottom again, breaking that guarantee.
lightning/lightningd/lightningd.c
Lines 1238 to 1251 in 09a9673
In my opinion this makes use of
backup.py
plugin unsafe (again).@rustyrussell Why the change?
#5577 mentions an issue, but has no further reference, about:
Seriously?
edit Above issue with the
db_write
hook also applies in general to other hooks. When plugins are freed during shutdown their hooks are unregistered and one expects that these hooks cannot be called after that (i.e. thatlightningd
is sufficiently dead), this was the case before e7fe59b. Now some subdaemons are kept alive longer, for example connectd happily accepts incoming connections during the 30s shutdown window. But any plugin that registered thepeer_connected
hook and maybe would reject the peer, is gone!This was already discussed in #4883 and so the answer to the title seems (sadly) 'Yes'.
How unsafe is it? I don't know, missing a
peer_connected
hook doesn't seem very harmful, just ugly and inconsistent. What about other hooks? And why is hsmd still running, will it sign anything?So far no response from the author of e7fe59b, perhaps @niftynei can help me out what the issues where with bookkeeper before that commit?
The text was updated successfully, but these errors were encountered: