get10101 / 10101-PoC

The world needs more Lightning!
MIT License
17 stars 3 forks source link

Error: `cannot acquire wallet lock, null` #357

Closed da-kami closed 1 year ago

da-kami commented 1 year ago

Context of when this happened:

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: FfiException(PANIC_ERROR, called `Result::unwrap()` on an `Err` value: PoisonError { .. }, null)
#0      FlutterRustBridgeBase._transformRust2DartMessage (package:flutter_rust_bridge/src/basic.dart:101:9)
#1      FlutterRustBridgeBase.executeNormal.<anonymous closure> (package:flutter_rust_bridge/src/basic.dart:49:9)
<asynchronous suspension>
#2      _TenTenOneState._callSync (package:ten_ten_one/main.dart:233:21)
<asynchronous suspension>
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: FfiException(RESULT_ERROR, cannot acquire wallet lock, null)
#0      FlutterRustBridgeBase._transformRust2DartMessage (package:flutter_rust_bridge/src/basic.dart:101:9)
#1      FlutterRustBridgeBase.executeNormal.<anonymous closure> (package:flutter_rust_bridge/src/basic.dart:49:9)
<asynchronous suspension>
#2      _TenTenOneState._callSyncPaymentHistory (package:ten_ten_one/main.dart:246:30)
<asynchronous suspension>
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: FfiException(RESULT_ERROR, cannot acquire wallet lock, null)
#0      FlutterRustBridgeBase._transformRust2DartMessage (package:flutter_rust_bridge/src/basic.dart:101:9)
#1      FlutterRustBridgeBase.executeNormal.<anonymous closure> (package:flutter_rust_bridge/src/basic.dart:49:9)
<asynchronous suspension>
#2      _TenTenOneState._callSync (package:ten_ten_one/main.dart:233:21)
<asynchronous suspension>
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: FfiException(RESULT_ERROR, cannot acquire wallet lock, null)
#0      FlutterRustBridgeBase._transformRust2DartMessage (package:flutter_rust_bridge/src/basic.dart:101:9)
#1      FlutterRustBridgeBase.executeNormal.<anonymous closure> (package:flutter_rust_bridge/src/basic.dart:49:9)
<asynchronous suspension>
#2      _TenTenOneState._callSyncPaymentHistory (package:ten_ten_one/main.dart:246:30)
<asynchronous suspension>
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: FfiException(RESULT_ERROR, cannot acquire wallet lock, null)
#0      FlutterRustBridgeBase._transformRust2DartMessage (package:flutter_rust_bridge/src/basic.dart:101:9)
#1      FlutterRustBridgeBase.executeNormal.<anonymous closure> (package:flutter_rust_bridge/src/basic.dart:49:9)
<asynchronous suspension>
klochowicz commented 1 year ago

I fixed the spot where it errored - I assume we are holding the lock for too long here: https://github.com/itchysats/10101/blob/main/rust/src/wallet.rs#L519

da-kami commented 1 year ago

I fixed the spot where it errored - I assume we are holding the lock for too long here: https://github.com/itchysats/10101/blob/main/rust/src/wallet.rs#L519

I don't think this can be the problem because this is open_channel and we are able to e.g. open a cfd afterwards.

When trying again I actually noticed that there was another error prior to the wallet lock error (on my retry) - I am not sure it is related but it could be:

The Flutter DevTools debugger and profiler on iPhone 14 Pro Max is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:52481/pfzrsf6__Bs=/
flutter: {_CfdOrderConfirmationState} {build} {Failed to open CFD: assertion failed: broadcaster_max_commitment_tx_output.0 <= value_to_self_msat as u64 ||\n    value_to_self_msat / 1000 >=\n        self.counterparty_selected_channel_reserve_satoshis.unwrap() as i64} {FfiException(PANIC_ERROR, assertion failed: broadcaster_max_commitment_tx_output.0 <= value_to_self_msat as u64 ||\n    value_to_self_msat / 1000 >=\n        self.counterparty_selected_channel_reserve_satoshis.unwrap() as i64, null)} {LogLevel.ERROR} {24 November 2022 04:53:31 PM}
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: FfiException(PANIC_ERROR, called `Result::unwrap()` on an `Err` value: PoisonError { .. }, null)
#0      FlutterRustBridgeBase._transformRust2DartMessage (package:flutter_rust_bridge/src/basic.dart:101:9)
#1      FlutterRustBridgeBase.executeNormal.<anonymous closure> (package:flutter_rust_bridge/src/basic.dart:49:9)
<asynchronous suspension>
#2      _TenTenOneState._callSync (package:ten_ten_one/main.dart:233:21)
<asynchronous suspension>
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: FfiException(RESULT_ERROR, cannot acquire wallet lock, null)
#0      FlutterRustBridgeBase._transformRust2DartMessage (package:flutter_rust_bridge/src/basic.dart:101:9)
#1      FlutterRustBridgeBase.executeNormal.<anonymous closure> (package:flutter_rust_bridge/src/basic.dart:49:9)
<asynchronous suspension>

I think the problem is related to my balance not being enough and opening the CFD failing - why the wallet would remain locked after that I cannot understand 😅

da-kami commented 1 year ago

For the release: Only invest time into this once all other tickets are done, this is likely a timesink :)