Skip to content
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

Deadlock by immediately invoking UnlockWallet after InitWallet #3631

Closed
stridentbean opened this issue Oct 23, 2019 · 14 comments · Fixed by #4985
Closed

Deadlock by immediately invoking UnlockWallet after InitWallet #3631

stridentbean opened this issue Oct 23, 2019 · 14 comments · Fixed by #4985
Labels
bug Unintended code behaviour P3 might get fixed, nice to have rpc Related to the RPC interface v0.12 wallet The wallet (lnwallet) which LND uses
Milestone

Comments

@stridentbean
Copy link

stridentbean commented Oct 23, 2019

Background

I'm upgrading our node software to use 0.8.0. It works fine if we are upgrading from 0.7.X to 0.8.0, but runs into an issue during wallet creation.

Your environment

  • lnd v0.8.0
  • OS: Linux ip-172-31-18-221.ec2.internal 4.14.104-95.84.amzn2.x86_64 Fix name typo in README #1 SMP Sat Mar 2 00:40:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • OS: also on rpi4
  • bitcoind 0.18.0
  • Running in docker containers
  • testnet

Expected behaviour

Wallet creation via rpc should occur as per usual resulting in several macaroons created and a wallet.db file.

Actual behavior

We use an rpc call to create the wallet. The call returns successful, but afterwords no macaroon files have been created. The wallet.db does exist. The logs are listed below at this point. It also looks like lnd syncing has not started.

After that I went to the command line and ran lncli unlock to get this error [lncli] rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: Error while dialing dial tcp 127.0.0.1:10009: connect: connection refused" I then restarted the lnd docker container and tried lncli unlock again. This time it did work and all the macaroon files were created and everything works as normal.

Conf file is

# Log file location
logdir=/usr/local/casa/chains/lnd/logs

# Static Channel Backup location
backupfilepath=/root/.lnd/data/scb/channels.backup

# Logging level
debuglevel=trace

Logs after wallet creation call

2019-10-23 20:38:21.746 [INF] LTND: Version: 0.8.0-beta commit=v0.8.0-beta, build=production, logging=default
2019-10-23 20:38:21.746 [INF] LTND: Active chain: Bitcoin (network=testnet)
2019-10-23 20:38:21.753 [INF] CHDB: Checking for schema update: latest_version=11, db_version=11
2019-10-23 20:38:21.754 [INF] RPCS: Generating TLS certificates...
2019-10-23 20:38:21.756 [INF] RPCS: Done generating TLS certificates
2019-10-23 20:38:21.757 [INF] RPCS: password gRPC proxy started at 127.0.0.1:8080
2019-10-23 20:38:21.757 [INF] RPCS: password RPC server listening on 127.0.0.1:10009
2019-10-23 20:38:21.757 [INF] LTND: Waiting for wallet encryption password. Use `lncli create` to create a wallet, `lncli unlock` to unlock an existing wallet, or `lncli changepassword` to change the password of an existing wallet and unlock it.
2019-10-23 20:38:52.797 [INF] LNWL: Opened wallet
@wpaulino
Copy link
Contributor

Are you able to reproduce this reliably? It seems like it was stuck opening the wallet database, which didn't allow lnd to proceed and create the macaroon files. How long was it in this state before restarting?

@stridentbean
Copy link
Author

It's 100% reliable on our setup. I'm not sure how long I waited, several minutes at least.

@Roasbeef
Copy link
Member

Unable to reproduce this locally, are you sure your backend is active and accepting connections? For example, if your bitcoind node is down, then lnd will just sit there waiting for the chance to establish a backend connection.

@stridentbean
Copy link
Author

I just erased the wallet.db swapped back to lnd v0.7.1 and I was able to generate a new wallet and macaroons properly.

@guggero
Copy link
Collaborator

guggero commented Oct 24, 2019

From the logs it looks like lnd is stuck before it can spin up the final gRPC and REST server. Macaroons are only created shortly before that. Can you please increase the log level to debug and post the last lines after unlock?

@stridentbean
Copy link
Author

@guggero I set my logging level to --debuglevel=debug when executing lnd and also turned up debugging to trace in the conf file. Neither of those is helping me to get more granular logs.

@wpaulino
Copy link
Contributor

@stridentbean does using the --sync-freelist flag have any effect?

@stridentbean
Copy link
Author

@wpaulino I added --sync-freelist to lnd when it boots and that hasn't helped.

I've compiled 0.8.0 on my own and threw in some low tech ltndLog.Infof("XYZ") lines to see where it is getting stuck.

Strangely, I can get all the way to https://github.com/lightningnetwork/lnd/blob/v0.8.0-beta/lnd.go#L1118. But, it never returns to execute this line https://github.com/lightningnetwork/lnd/blob/v0.8.0-beta/lnd.go#L318.

@wpaulino
Copy link
Contributor

Interesting. Could you restart with --profile=PORT, wait until it gets stuck again, and post the output of curl "http://localhost:PORT/debug/pprof/goroutine?debug=1"?

@stridentbean
Copy link
Author

Running bash-5.0# curl http://localhost:4000/debug/pprof/goroutine?debug=1 from inside my lnd docker containers results in ...

goroutine profile: total 14
1 @ 0x8052c8e 0x808a2bf 0x8869dba 0x80a0b41
#	0x808a2be	os/signal.signal_recv+0x12e	/usr/local/go/src/runtime/sigqueue.go:147
#	0x8869db9	os/signal.loop+0x19		/usr/local/go/src/os/signal/signal_unix.go:23

1 @ 0x8077594 0x804e2c2 0x804e29d 0x804e00c 0x87bab32 0x87ac1a4 0x8968ff4 0x80a0b41
#	0x87bab31	google.golang.org/grpc.(*Server).Serve.func1+0x71			/go/pkg/mod/google.golang.org/[email protected]/server.go:531
#	0x87ac1a3	google.golang.org/grpc.(*Server).Serve+0x573				/go/pkg/mod/google.golang.org/[email protected]/server.go:587
#	0x8968ff3	github.com/lightningnetwork/lnd.waitForWalletPassword.func1+0xd3	/go/src/github.com/lightningnetwork/lnd/lnd.go:1055

1 @ 0x8077594 0x8072154 0x807162b 0x80fe987 0x80ff66d 0x80ff652 0x81d794f 0x81e7cf6 0x82d9eb1 0x8123d85 0x82da0ab 0x82d8a74 0x82dc066 0x82dc06f 0x8128066 0x80df644 0x8727dae 0x8727d72 0x87284b6 0x8745adc 0x87acd20 0x87bacc1 0x80a0b41
#	0x807162a	internal/poll.runtime_pollWait+0x4a						/usr/local/go/src/runtime/netpoll.go:184
#	0x80fe986	internal/poll.(*pollDesc).wait+0x36						/usr/local/go/src/internal/poll/fd_poll_runtime.go:87
#	0x80ff66c	internal/poll.(*pollDesc).waitRead+0x16c					/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
#	0x80ff651	internal/poll.(*FD).Read+0x151							/usr/local/go/src/internal/poll/fd_unix.go:169
#	0x81d794e	net.(*netFD).Read+0x3e								/usr/local/go/src/net/fd_unix.go:202
#	0x81e7cf5	net.(*conn).Read+0x55								/usr/local/go/src/net/net.go:184
#	0x82d9eb0	crypto/tls.(*atLeastReader).Read+0x60						/usr/local/go/src/crypto/tls/conn.go:780
#	0x8123d84	bytes.(*Buffer).ReadFrom+0x94							/usr/local/go/src/bytes/buffer.go:204
#	0x82da0aa	crypto/tls.(*Conn).readFromUntil+0xca						/usr/local/go/src/crypto/tls/conn.go:802
#	0x82d8a73	crypto/tls.(*Conn).readRecordOrCCS+0x113					/usr/local/go/src/crypto/tls/conn.go:609
#	0x82dc065	crypto/tls.(*Conn).readRecord+0x135						/usr/local/go/src/crypto/tls/conn.go:577
#	0x82dc06e	crypto/tls.(*Conn).Read+0x13e							/usr/local/go/src/crypto/tls/conn.go:1255
#	0x8128065	bufio.(*Reader).Read+0x1f5							/usr/local/go/src/bufio/bufio.go:226
#	0x80df643	io.ReadAtLeast+0x73								/usr/local/go/src/io/io.go:310
#	0x8727dad	io.ReadFull+0x6d								/usr/local/go/src/io/io.go:329
#	0x8727d71	golang.org/x/net/http2.readFrameHeader+0x31					/go/pkg/mod/golang.org/x/[email protected]/http2/frame.go:237
#	0x87284b5	golang.org/x/net/http2.(*Framer).ReadFrame+0x75					/go/pkg/mod/golang.org/x/[email protected]/http2/frame.go:492
#	0x8745adb	google.golang.org/grpc/internal/transport.(*http2Server).HandleStreams+0x5b	/go/pkg/mod/google.golang.org/[email protected]/internal/transport/http2_server.go:429
#	0x87acd1f	google.golang.org/grpc.(*Server).serveStreams+0xbf				/go/pkg/mod/google.golang.org/[email protected]/server.go:681
#	0x87bacc0	google.golang.org/grpc.(*Server).handleRawConn.func1+0x30			/go/pkg/mod/google.golang.org/[email protected]/server.go:643

1 @ 0x8077594 0x8072154 0x807162b 0x80fe987 0x80ff66d 0x80ff652 0x81d794f 0x81e7cf6 0x8430806 0x80a0b41
#	0x807162a	internal/poll.runtime_pollWait+0x4a		/usr/local/go/src/runtime/netpoll.go:184
#	0x80fe986	internal/poll.(*pollDesc).wait+0x36		/usr/local/go/src/internal/poll/fd_poll_runtime.go:87
#	0x80ff66c	internal/poll.(*pollDesc).waitRead+0x16c	/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
#	0x80ff651	internal/poll.(*FD).Read+0x151			/usr/local/go/src/internal/poll/fd_unix.go:169
#	0x81d794e	net.(*netFD).Read+0x3e				/usr/local/go/src/net/fd_unix.go:202
#	0x81e7cf5	net.(*conn).Read+0x55				/usr/local/go/src/net/net.go:184
#	0x8430805	net/http.(*connReader).backgroundRead+0x45	/usr/local/go/src/net/http/server.go:677

1 @ 0x8077594 0x8072154 0x807162b 0x80fe987 0x8100a2a 0x8100a0f 0x81d8027 0x81f0bf7 0x81ef78c 0x843923f 0x8438fd0 0x89686eb 0x89686f4 0x80a0b41
#	0x807162a	internal/poll.runtime_pollWait+0x4a			/usr/local/go/src/runtime/netpoll.go:184
#	0x80fe986	internal/poll.(*pollDesc).wait+0x36			/usr/local/go/src/internal/poll/fd_poll_runtime.go:87
#	0x8100a29	internal/poll.(*pollDesc).waitRead+0x199		/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
#	0x8100a0e	internal/poll.(*FD).Accept+0x17e			/usr/local/go/src/internal/poll/fd_unix.go:384
#	0x81d8026	net.(*netFD).accept+0x26				/usr/local/go/src/net/fd_unix.go:238
#	0x81f0bf6	net.(*TCPListener).accept+0x26				/usr/local/go/src/net/tcpsock_posix.go:139
#	0x81ef78b	net.(*TCPListener).Accept+0x3b				/usr/local/go/src/net/tcpsock.go:261
#	0x843923e	net/http.(*Server).Serve+0x22e				/usr/local/go/src/net/http/server.go:2896
#	0x8438fcf	net/http.(*Server).ListenAndServe+0x9f			/usr/local/go/src/net/http/server.go:2825
#	0x89686ea	net/http.ListenAndServe+0x16a				/usr/local/go/src/net/http/server.go:3080
#	0x89686f3	github.com/lightningnetwork/lnd.Main.func2+0x173	/go/src/github.com/lightningnetwork/lnd/lnd.go:166

1 @ 0x8077594 0x8085e19 0x80e0b24 0x80e11fb 0x8127aa9 0x8128692 0x812886a 0x887cedd 0x80a0b41
#	0x80e0b23	io.(*pipe).Read+0xb3					/usr/local/go/src/io/pipe.go:50
#	0x80e11fa	io.(*PipeReader).Read+0x3a				/usr/local/go/src/io/pipe.go:127
#	0x8127aa8	bufio.(*Reader).fill+0xe8				/usr/local/go/src/bufio/bufio.go:100
#	0x8128691	bufio.(*Reader).ReadSlice+0x31				/usr/local/go/src/bufio/bufio.go:359
#	0x8128869	bufio.(*Reader).ReadLine+0x29				/usr/local/go/src/bufio/bufio.go:388
#	0x887cedc	github.com/jrick/logrotate/rotator.(*Rotator).Run+0x8c	/go/pkg/mod/github.com/jrick/[email protected]/rotator/rotator.go:100

1 @ 0x8077594 0x8085e19 0x8504e22 0x80a0b41
#	0x8504e21	github.com/btcsuite/btcwallet/wallet.(*Wallet).txCreator+0xc1	/go/pkg/mod/github.com/btcsuite/[email protected]/wallet/wallet.go:1160

1 @ 0x8077594 0x8085e19 0x8505352 0x80a0b41
#	0x8505351	github.com/btcsuite/btcwallet/wallet.(*Wallet).walletLocker+0x1f1	/go/pkg/mod/github.com/btcsuite/[email protected]/wallet/wallet.go:1238

1 @ 0x8077594 0x8085e19 0x87347b5 0x8734db8 0x8751cda 0x80a0b41
#	0x87347b4	google.golang.org/grpc/internal/transport.(*controlBuffer).get+0xc4	/go/pkg/mod/google.golang.org/[email protected]/internal/transport/controlbuf.go:317
#	0x8734db7	google.golang.org/grpc/internal/transport.(*loopyWriter).run+0x177	/go/pkg/mod/google.golang.org/[email protected]/internal/transport/controlbuf.go:435
#	0x8751cd9	google.golang.org/grpc/internal/transport.newHTTP2Server.func2+0xa9	/go/pkg/mod/google.golang.org/[email protected]/internal/transport/http2_server.go:276

1 @ 0x8077594 0x8085e19 0x8749062 0x80a0b41
#	0x8749061	google.golang.org/grpc/internal/transport.(*http2Server).keepalive+0x1d1	/go/pkg/mod/google.golang.org/[email protected]/internal/transport/http2_server.go:921

1 @ 0x8077594 0x8085e19 0x886a1d1 0x80a0b41
#	0x886a1d0	github.com/lightningnetwork/lnd/signal.mainInterruptHandler+0xd0	/go/src/github.com/lightningnetwork/lnd/signal/signal.go:70

1 @ 0x8077594 0x8087941 0x808791c 0x80b93f6 0x87b1a8f 0x89243fc 0x8920b13 0x897a58d 0x80771c2 0x80a0b41
#	0x808791b	sync.runtime_notifyListWait+0xfb				/usr/local/go/src/runtime/sema.go:510
#	0x80b93f5	sync.(*Cond).Wait+0x65						/usr/local/go/src/sync/cond.go:56
#	0x87b1a8e	google.golang.org/grpc.(*Server).GracefulStop+0x1be		/go/pkg/mod/google.golang.org/[email protected]/server.go:1401
#	0x89243fb	github.com/lightningnetwork/lnd.waitForWalletPassword+0x152b	/go/src/github.com/lightningnetwork/lnd/lnd.go:1176
#	0x8920b12	github.com/lightningnetwork/lnd.Main+0x3652			/go/src/github.com/lightningnetwork/lnd/lnd.go:332
#	0x897a58c	main.main+0x3c							/go/src/github.com/lightningnetwork/lnd/cmd/lnd/main.go:14
#	0x80771c1	runtime.main+0x201						/usr/local/go/src/runtime/proc.go:203

1 @ 0x8077594 0x8090969 0x8090944 0x8286d7e 0x828bcfc 0x864c0a3 0x864c7e1 0x837d8be 0x84fa9f3 0x887c386 0x8823ad5 0x87ae1aa 0x87b1607 0x87bad9b 0x80a0b41
#	0x8090943	time.Sleep+0x133									/usr/local/go/src/runtime/time.go:105
#	0x8286d7d	github.com/coreos/bbolt.flock+0x9d							/go/pkg/mod/github.com/coreos/[email protected]/bolt_unix.go:40
#	0x828bcfb	github.com/coreos/bbolt.Open+0x15b							/go/pkg/mod/github.com/coreos/[email protected]/db.go:223
#	0x864c0a2	github.com/btcsuite/btcwallet/walletdb/bdb.openDB+0x82					/go/pkg/mod/github.com/btcsuite/btcwallet/[email protected]/bdb/db.go:354
#	0x864c7e0	github.com/btcsuite/btcwallet/walletdb/bdb.openDBDriver+0x90				/go/pkg/mod/github.com/btcsuite/btcwallet/[email protected]/bdb/driver.go:50
#	0x837d8bd	github.com/btcsuite/btcwallet/walletdb.Open+0x6d					/go/pkg/mod/github.com/btcsuite/btcwallet/[email protected]/interface.go:303
#	0x84fa9f2	github.com/btcsuite/btcwallet/wallet.(*Loader).OpenExistingWallet+0x1e2			/go/pkg/mod/github.com/btcsuite/[email protected]/wallet/loader.go:173
#	0x887c385	github.com/lightningnetwork/lnd/walletunlocker.(*UnlockerService).UnlockWallet+0x175	/go/src/github.com/lightningnetwork/lnd/walletunlocker/service.go:336
#	0x8823ad4	github.com/lightningnetwork/lnd/lnrpc._WalletUnlocker_UnlockWallet_Handler+0x194	/go/src/github.com/lightningnetwork/lnd/lnrpc/rpc.pb.go:9865
#	0x87ae1a9	google.golang.org/grpc.(*Server).processUnaryRPC+0x4e9					/go/pkg/mod/google.golang.org/[email protected]/server.go:966
#	0x87b1606	google.golang.org/grpc.(*Server).handleStream+0xa56					/go/pkg/mod/google.golang.org/[email protected]/server.go:1245
#	0x87bad9a	google.golang.org/grpc.(*Server).serveStreams.func1.1+0x8a				/go/pkg/mod/google.golang.org/[email protected]/server.go:685

1 @ 0x860c95c 0x860c7ca 0x8609823 0x8868b44 0x8869297 0x8436724 0x8437f10 0x8438f04 0x84356dd 0x80a0b41
#	0x860c95b	runtime/pprof.writeRuntimeProfile+0x7b	/usr/local/go/src/runtime/pprof/pprof.go:708
#	0x860c7c9	runtime/pprof.writeGoroutine+0x79	/usr/local/go/src/runtime/pprof/pprof.go:670
#	0x8609822	runtime/pprof.(*Profile).WriteTo+0x2c2	/usr/local/go/src/runtime/pprof/pprof.go:329
#	0x8868b43	net/http/pprof.handler.ServeHTTP+0x273	/usr/local/go/src/net/http/pprof/pprof.go:245
#	0x8869296	net/http/pprof.Index+0x4d6		/usr/local/go/src/net/http/pprof/pprof.go:268
#	0x8436723	net/http.HandlerFunc.ServeHTTP+0x33	/usr/local/go/src/net/http/server.go:2007
#	0x8437f0f	net/http.(*ServeMux).ServeHTTP+0x16f	/usr/local/go/src/net/http/server.go:2387
#	0x8438f03	net/http.serverHandler.ServeHTTP+0x83	/usr/local/go/src/net/http/server.go:2802
#	0x84356dc	net/http.(*conn).serve+0x7ac		/usr/local/go/src/net/http/server.go:1890

@wpaulino
Copy link
Contributor

This is when creating a new wallet? The profile shows that lnd is handling an UnlockWallet call:

1 @ 0x8077594 0x8090969 0x8090944 0x8286d7e 0x828bcfc 0x864c0a3 0x864c7e1 0x837d8be 0x84fa9f3 0x887c386 0x8823ad5 0x87ae1aa 0x87b1607 0x87bad9b 0x80a0b41
#	0x8090943	time.Sleep+0x133									/usr/local/go/src/runtime/time.go:105
#	0x8286d7d	github.com/coreos/bbolt.flock+0x9d							/go/pkg/mod/github.com/coreos/[email protected]/bolt_unix.go:40
#	0x828bcfb	github.com/coreos/bbolt.Open+0x15b							/go/pkg/mod/github.com/coreos/[email protected]/db.go:223
#	0x864c0a2	github.com/btcsuite/btcwallet/walletdb/bdb.openDB+0x82					/go/pkg/mod/github.com/btcsuite/btcwallet/[email protected]/bdb/db.go:354
#	0x864c7e0	github.com/btcsuite/btcwallet/walletdb/bdb.openDBDriver+0x90				/go/pkg/mod/github.com/btcsuite/btcwallet/[email protected]/bdb/driver.go:50
#	0x837d8bd	github.com/btcsuite/btcwallet/walletdb.Open+0x6d					/go/pkg/mod/github.com/btcsuite/btcwallet/[email protected]/interface.go:303
#	0x84fa9f2	github.com/btcsuite/btcwallet/wallet.(*Loader).OpenExistingWallet+0x1e2			/go/pkg/mod/github.com/btcsuite/[email protected]/wallet/loader.go:173
#	0x887c385	github.com/lightningnetwork/lnd/walletunlocker.(*UnlockerService).UnlockWallet+0x175	/go/src/github.com/lightningnetwork/lnd/walletunlocker/service.go:336
#	0x8823ad4	github.com/lightningnetwork/lnd/lnrpc._WalletUnlocker_UnlockWallet_Handler+0x194	/go/src/github.com/lightningnetwork/lnd/lnrpc/rpc.pb.go:9865
#	0x87ae1a9	google.golang.org/grpc.(*Server).processUnaryRPC+0x4e9					/go/pkg/mod/google.golang.org/[email protected]/server.go:966
#	0x87b1606	google.golang.org/grpc.(*Server).handleStream+0xa56					/go/pkg/mod/google.golang.org/[email protected]/server.go:1245
#	0x87bad9a	google.golang.org/grpc.(*Server).serveStreams.func1.1+0x8a				/go/pkg/mod/google.golang.org/[email protected]/server.go:685

Do you have some sort of unlock script that's being executed?

@stridentbean
Copy link
Author

Interesting.

In our stack, we do have an unlock immediately after wallet initialization. It is redundant, so I will remove it to unblock us.

It's probably still worth it to fix that issue from lnd's side. Not sure if that locking could happen in other cases.

Thanks so much for the help on this one.

@wpaulino wpaulino changed the title Macaroons not generated after wallet creation Deadlock by immediately invoking UnlockWallet after InitWallet Oct 28, 2019
@wpaulino wpaulino added bug Unintended code behaviour P3 might get fixed, nice to have rpc Related to the RPC interface wallet The wallet (lnwallet) which LND uses labels Oct 28, 2019
@dannypaz
Copy link
Contributor

dannypaz commented Dec 23, 2019

Wanted to add some information to this issue. Not entirely sure if this bug is caused by using unlock with init. We (sparkswap) have had some users who have created wallets on LND, only to not have the macaroons created. Users are experiencing this on Catalina and Windows 10.

Unfortunately we haven't been able to reproduce. If we receive any logs we'll post them here

@wpaulino
Copy link
Contributor

wpaulino commented Jan 6, 2020

@dannypaz Init and Unlock are mutually exclusive. Init should only be used the first time for new wallets, it will unlock the wallet as well. Unlock should be used every other time the wallet is started.

Roasbeef added a commit to Roasbeef/lnd that referenced this issue Jun 9, 2020
In this commit, we fix a deadlock that can happen if a user attempts to
init then rapidly unlock a wallet right after. In my profiles, it seems
the lnd gets caught up on the bbolt flock, which deadlocks the entire
process. We fix this issue by making the Init/Unlock calls now fully
synchronous. Only a single outstanding request can exist across the
entire wallet unlocker service now.

Fixes lightningnetwork#4330.

Fixes lightningnetwork#3631.
@Roasbeef Roasbeef added this to the 0.12.0 milestone Jul 22, 2020
@Roasbeef Roasbeef added the v0.12 label Jul 22, 2020
@Roasbeef Roasbeef removed this from the 0.12.0 milestone Oct 27, 2020
@Roasbeef Roasbeef added this to the 0.13.0 milestone Oct 27, 2020
carlaKC added a commit to carlaKC/lndclient that referenced this issue Jan 5, 2021
This commit adds an optional wait for lnd to unlock to LndServices.
The wallet unlocker is not used, because polling the unlock endpoin|
exacerbates a known deadlock:
lightningnetwork/lnd#3631.

Instead, a call to the main grpc server is used. The wallet is
considered locked when we receive a grpc unimplemented error, because
the main server does not become active until the wallet is unlocked.
Once the wallet is unlocked, there is a race condition where a query
to the main server can return an unavailable code while the server is
busy registering. This error is the same as when lnd is just not online
at all, so we allow it to occur once (assuming our backoff period will
be sufficient) to account for this race while still failing if lnd is
consistently offline.
carlaKC added a commit to carlaKC/lndclient that referenced this issue Jan 5, 2021
This commit adds an optional wait for lnd to unlock to LndServices.
The wallet unlocker is not used, because polling the unlock endpoint
exacerbates a known deadlock:
lightningnetwork/lnd#3631.

Instead, a call to the main grpc server is used. The wallet is
considered locked when we receive a grpc unimplemented error, because
the main server does not become active until the wallet is unlocked.
Once the wallet is unlocked, there is a race condition where a query
to the main server can return an unavailable code while the server is
busy registering. This error is the same as when lnd is just not online
at all, so we allow it to occur once (assuming our backoff period will
be sufficient) to account for this race while still failing if lnd is
consistently offline.
carlaKC added a commit to carlaKC/lndclient that referenced this issue Jan 5, 2021
This commit adds an optional wait for lnd to unlock to LndServices.
The wallet unlocker is not used, because polling the unlock endpoint
exacerbates a known deadlock:
lightningnetwork/lnd#3631.

Instead, a call to the main grpc server is used. The wallet is
considered locked when we receive a grpc unimplemented error, because
the main server does not become active until the wallet is unlocked.
Once the wallet is unlocked, there is a race condition where a query
to the main server can return an unavailable code while the server is
busy registering. This error is the same as when lnd is just not online
at all, so we allow it to occur once (assuming our backoff period will
be sufficient) to account for this race while still failing if lnd is
consistently offline.
carlaKC added a commit to carlaKC/lndclient that referenced this issue Jan 5, 2021
This commit adds an optional wait for lnd to unlock to LndServices.
The wallet unlocker is not used, because polling the unlock endpoint
exacerbates a known deadlock:
lightningnetwork/lnd#3631.

Instead, a call to the main grpc server is used. The wallet is
considered locked when we receive a grpc unimplemented error, because
the main server does not become active until the wallet is unlocked.
Once the wallet is unlocked, there is a race condition where a query
to the main server can return an unavailable code while the server is
busy registering. This error is the same as when lnd is just not online
at all, so we allow it to occur once (assuming our backoff period will
be sufficient) to account for this race while still failing if lnd is
consistently offline.
carlaKC added a commit to carlaKC/lndclient that referenced this issue Jan 11, 2021
This commit adds an optional wait for lnd to unlock to LndServices.
The wallet unlocker is not used, because polling the unlock endpoint
exacerbates a known deadlock:
lightningnetwork/lnd#3631.

Instead, a call to the main grpc server is used. The wallet is
considered locked when we receive a grpc unimplemented error, because
the main server does not become active until the wallet is unlocked.
Once the wallet is unlocked, there is a race condition where a query
to the main server can return an unavailable code while the server is
busy registering. We use the grpc wait until ready error which will
allow the call to wait until our wait interval has elapsed before it
fails. This allows lnd some time to come up.
carlaKC added a commit to carlaKC/lndclient that referenced this issue Jan 11, 2021
This commit adds an optional wait for lnd to unlock to LndServices.
The wallet unlocker is not used, because polling the unlock endpoint
exacerbates a known deadlock:
lightningnetwork/lnd#3631.

Instead, a call to the main grpc server is used. The wallet is
considered locked when we receive a grpc unimplemented error, because
the main server does not become active until the wallet is unlocked.
Once the wallet is unlocked, there is a race condition where a query
to the main server can return an unavailable code while the server is
busy registering. We use the grpc wait until ready error which will
allow the call to wait until our wait interval has elapsed before it
fails. This allows lnd some time to come up.
carlaKC added a commit to carlaKC/lndclient that referenced this issue Jan 11, 2021
This commit adds an optional wait for lnd to unlock to LndServices.
The wallet unlocker is not used, because polling the unlock endpoint
exacerbates a known deadlock:
lightningnetwork/lnd#3631.

Instead, a call to the main grpc server is used. The wallet is
considered locked when we receive a grpc unimplemented error, because
the main server does not become active until the wallet is unlocked.
Once the wallet is unlocked, there is a race condition where a query
to the main server can return an unavailable code while the server is
busy registering. We use the grpc wait until ready error which will
allow the call to wait until our wait interval has elapsed before it
fails. This allows lnd some time to come up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unintended code behaviour P3 might get fixed, nice to have rpc Related to the RPC interface v0.12 wallet The wallet (lnwallet) which LND uses
Projects
None yet
5 participants