Open dpc opened 3 months ago
Can I work on this if the issue has not been solved?
Would checking if a daemon like bitcoind is running after every few seconds, as set in config file work and log an ERROR
on each retry and log an INFO
on each successful connection solve the issue ?
There's some design debate here to be had, I guess. Does electrs
really need to connect on start to bitcoind
? If so, it probably could block for some time, sleep ,retry, etc. until maybe eventually give up. If not really - then doing on start should be converted to a normal operation loop. What I mean by that: in a normal operation electrs probably runs some loop/listen for notifications etc. and can tolerate temporary connectivity issues by just retrying. Maybe whatever is failing if bitcoind is not reachable on start, could be converted to be a part of such a high-level operation loop and retry all the same if anything goes wrong.
Describe the bug
The core question is - should a daemon like electrs crash on start if it can't connected to bitcoind?
Note the first timestamp:
20:13.921
the whole test suite started:
timestamp:
20:13.911
bitcoind
spawned in the background earlier, but was available for querying only a few seconds later. But 30ms into the test suite,electrs
already gave up on it.It seems like all Bitcoin daemons we're using are like that: lightningd, lnd, electrs. which makes me wonder - is this some shared design decision, that I never learned, or just a weird coincidence. :D . All three are different languages, different teams etc.
Sure in a real deployment, there always will be some kind of supervisor to restart things, but still... I would expect daemons to never shut down just because they can't connect to another networked service. What's the point, if the supervisor ... is just going to start them again.
The context is: I'm trying to optimize our test suite starting time: letting more things start in parallel, etc. And it would be nice if I could start some daemons around the same time I'm starting
bitcoind
, and not have to postpone everything untilbitcoind
takes a shower, brushes teeth, eats breakfast and is finally ready for work.