Description
environment: Running against spruned on ubuntu. Both spruned and lightning running over tor.
When I start lightningd, it does not quickly exit back to command-line (enter daemon mode) as it is supposed to. Instead, it just seems to hang. In debug.log, there are only two entries re "creating db" and "missing gossip messages".
After trying several things, including removing ~/.lightning entirely, I just let it stay that way. After approx 15 minutes, there is a line that estimatesmartfee rpc exited with status 1 and finally the daemon starts up.
2019-06-28T16:59:37.178Z lightningd(15089): Creating database
2019-06-28T16:59:37.463Z lightning_gossipd(15101): We seem to be missing gossip messages
2019-06-28T17:14:38.443Z lightningd(15089): bitcoin-cli: finished bitcoin-cli -datadir=/home/c-lightning/.bitcoin estimatesmartfee 100 ECONOMICAL (900034 ms)
2019-06-28T17:14:38.443Z lightningd(15089): bitcoin-cli -datadir=/home/c-lightning/.bitcoin estimatesmartfee 100 ECONOMICAL exited with status 1
2019-06-28T17:14:39.730Z lightningd(15089): --------------------------------------------------
2019-06-28T17:14:39.730Z lightningd(15089): Server started with public key ##, alias ### (color ####) and lightningd v0.7.1rc4
Okay, so a few observations here:
-
Seemingly spruned is taking a long time to serve estimatesmartfee for some reason. though if I try the same command now, it is instant.
-
I can't be certain that the time is spent waiting for spruned, as no message is logged when the rpc call begins, only upon return. And further, the log message does not indicate start or duration time of the call, only the end time. This is useless for profiling.edit: I see that duration in milliseconds is included in the log message that is (finally) printed after the call note: using log-level=debug. -
Clearly lightningd is making rpc call to bitcoind/spruned before it forks into daemon mode. I'm not sure why that is necessary. Anyway, it has the potential to stall lightning-cli (rpc api) for an arbitrary amount of time at startup.
Suggestions:
-
when log-level=debug, make a log entry before each rpc call, as well as after. Thus, it becomes more clear what is happening if something gets stuck.
-
If possible, move the call to estimatesmartfee to after the point at which the daemon forks.
And of course I am open to any ideas/explanations what may be going on here to make things so slow, and how to fix it on my end.