Open ghost opened 4 years ago
@d4amenace No. Indeed, bitcoind
was the first thing I checked and it was running fine, still having around the maximum number of connections. Also my Electrum Server was still running.
@sumBTC when you restart the node, the problem not longer exists right?
Is possible to have a piece of bitcoind log, if you have? I'm curious to know how the bitcoind answered from the gethashblock request
I'm my opinion, c-lightning receive some unexpected answer from bitcoind, I say this because I see this log line inside your original message
+353275.478713571 plugin-bcliUNUSUAL: bitcoin-cli getblockhash 642305 exited with status 1
@vincenzopalazzo Hi palazzone, you can find my bitcoind debug.log
here
EDIT: I looked at it myself and see a lot of "WARNING: request rejected because http work queue depth exceeded, it can be increased with the -rpcworkqueue= setting"
Don't know what it means
Edit:
when you restart the node, the problem not longer exists right?
right
We should not reach the work queue depth, since we specifically throttle our requests to bitcoind
to avoid that.
Unless you have multiple services talking to bitcoind
, not just lightningd
... do you?
I also run ElectrumX
(public Electrum Server) and another c-lightning (test) node only connected (only a channel to) to my main node (same version) and Electrum Personal Server
EDIT: my test c-lightning node didn't crash
From @ZmnSCPxj answer and your log, I can understand that for your c-lightning on mainet crashed because your network configuration with c-lightning and ElectrumX server make an attack like "Zombie attack on the network" in other words, the request made to bitcoind is too much and bitcoind said with the log "WARNING: request rejected because http work queue depth exceeded, it can be increased with the -rpcworkqueue= setting" Wait I have some work to do before receiving other requests.
You can increate the dimension of the queue how bitcoind suggests with the log.
P.S: c-lightning on testnet didn't crash because the testnet queue and mainet queue is different.
Another P.S: This is only my vision.
@vincenzopalazzo The question is of course should c-lightning crash for that reason?
BTW my other node is a test node (for software updates and other use), not a testnet node, it also runs on mainnet. Probably it wasn't making any requests.
Probably it wasn't making any requests.
It was. We have a loop every 10 seconds30 seconds or so that polls the bitcoind
for a new block, even if we have no channels or anything. With enough activity from your active node, the testing node, and ElectrumX, it could indeed periodically overload the queue depth.
That said... my understanding is that bcli
should still not crash then, it should keep retrying. @darosior ?
We should definitely be clearer in the documentation with our use of bitcoind
's rpc threads. It is quite picky and will refuse any concurrent request made above the -rpcthreads
(defaults to 4
) threshold (and sometimes silently iirc).
That said... my understanding is that bcli should still not crash then, it should keep retrying. @darosior ?
It should, under a certain treshold (1 minute).
As the log line preceding the death of bcli
tells, we've surely been retrying for 1 minute however we crash before telling you so.. (edit: reproduced, that's it)
My guess is that electrumx has been heavy loading your poor bitcoind
:-( (edit: ok it's definitely this given your debug.log ...).
@sumBTC (and anyone reading this): you should really increase the rpcthreads
configuration of your bitcoind
if you run another application than lightningd
on top of it.
Regarding the crash, i'll look into it..
@darosior I will. Thanks!
Ok, I've reproduced this locally so to sum up:
bitcoind
to give us an answer.lightningd
rudely exits so fast it doesn't treat the log explanation incoming from bcli
about why we crash. (patch incoming)@darosior nice! We might want to mention -rpcthreads
on README.md
If you have more than one `lightningd` instance using a single `bitcoind`, make sure to
increase `-rpcthreads` for your `bitcoind`.
Each `lightningd` instance consumes up to 4 RPC threads.
If you run other services on top of the same `bitcoind` as well, you will want to allocate
more `-rpcthreads` as well;
4 per service is a reasonable worst-case, but you should consult the documentation of
that service, or ask its developers.
If you have more than one `lightningd` instance using a single `bitcoind`, make sure to increase `-rpcthreads` for your `bitcoind`. Each `lightningd` instance consumes up to 4 RPC threads. If you run other services on top of the same `bitcoind` as well, you will want to allocate more `-rpcthreads` as well; 4 per service is a reasonable worst-case, but you should consult the documentation of that service, or ask its developers.
That's good to know! I actually have multiple lightningd's (20) running under a single bitcoind. Is there a maximum number of rpcthreads that a single bitcoind can handle?
@ZmnSCPxj The warning in the bitcoind
debug.log
suggests to increase via -rpcworkqueue
while here you suggest to increase via -rpcthreads
. Maybe the difference should be explained or maybe both should be set?
EDIT:
Found this in src/httpserver.h of the Bitcoin (0.20.0) software
static const int DEFAULT_HTTP_THREADS=4;
static const int DEFAULT_HTTP_WORKQUEUE=16;
I'm probably going to set the following in bitcoin.conf
rpcthreads=16
rpcworkqueue=64
so times 4.
@d4amenace depends on your machine, bitcoind will spawn any number of std::thread()
threads that you tell it to.
@ZmnSCPxj : yeah, but i checked the FAQ since my last comment and there is already a section about it. Do you think it's still worth including it in the README ? Or maybe we should include a "please quickly skim through the FAQ before running" :)
@sumBTC : bitcoind
will spawn rpcthreads
number of queue, each having a depth of rpcworkqueue
.
Regarding your config, i think you should also and especially check that electrumx
(and the others) are not filling all the available space ("Oh ! There is more space now, let's fill the queue with even more requests!"). Lightningd will never ever use more than 4 threads.
@darosior Yeah, running electrumx
is always challenging, especially during DDOS attacks. For example, electrumx
gets at maximum 30% of my cpu (using: cpulimit
) or it would practically crash my server during DDOS attacks. Nevertheless, running a public electrum server is important, also for lightning as many lightning wallets need it. I will have a look into how electrumx
handles threads.
Issue and Steps to Reproduce
C-lightning (v0.9.0-2-ge7d89cd) crashed while I wasn't doing anything and it was just running on my server: C-lightning ran fine again after a restart.
Here is the relevant crash log:
getinfo
output"version": "v0.9.0-2-ge7d89cd",