MutinyWallet / mutiny-web

The frontend for Mutiny Wallet
https://app.mutinywallet.com
MIT License
179 stars 59 forks source link

Firefox Fennec Browser for Android: Script terminated by timeout at #261

Open TonyGiorgio opened 1 year ago

TonyGiorgio commented 1 year ago

Just stalls out on the empty state loading screen.

Looks like it never finishes processing gossip data before it stalls out. Unfortunately an error screen does not appear after the script times out, so it will forever have an empty loading state which would be good to catch.

welcome back! index-2414d257.js:2:60781
checking for browser compatibility... index-2414d257.js:2:62657
Checking localstorage index-2414d257.js:2:58935
Checking WebAssembly index-2414d257.js:2:59122
Checking indexedDB index-2414d257.js:2:59457
Checking IndexedDB is on the window object index-2414d257.js:2:59634
Opening IndexedDB index-2414d257.js:2:59756
checking if any other tabs are open index-2414d257.js:2:62746
running setup node manager... index-2414d257.js:2:62908
DEBUG mutiny-wasm/src/utils.rs:20
Main function begins and ends index-2414d257.js:2:43646
Starting setup... index-2414d257.js:2:58510
Initializing Mutiny Manager index-2414d257.js:2:58602
Using network bitcoin index-2414d257.js:2:58645
Using proxy wss://p.mutinywallet.com index-2414d257.js:2:58676
Using esplora address https://mempool.space/api index-2414d257.js:2:58705
Using rgs address https://rapidsync.lightningdevkit.org/snapshot/ index-2414d257.js:2:58744
Using lsp address https://lsp.voltageapi.com index-2414d257.js:2:58779
DEBUG mutiny-core/src/logging.rs:117
2023-06-18 00:39:42.671 DEBUG [mutiny_wasm::indexed_db:179] Reading from local storage
index-2414d257.js:2:43646
DEBUG mutiny-core/src/logging.rs:117
2023-06-18 00:39:43.949 DEBUG [mutiny_core::gossip:133] Previous gossip sync timestamp: 0
index-2414d257.js:2:43646
INFO mutiny-core/src/logging.rs:118
2023-06-18 00:39:43.982 INFO  [mutiny_core::gossip:152] RGS URL: https://rapidsync.lightningdevkit.org/snapshot/0
index-2414d257.js:2:43560
DEBUG mutiny-core/src/logging.rs:117
2023-06-18 00:40:10.688 DEBUG [lightning_rapid_gossip_sync::processing:138] Processing RGS update from 1686873600 with 12315 nodes, 63290 channel announcements and 125454 channel updates. 

index-2414d257.js:2:43646
Script terminated by timeout at:
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[3411]:0x537e45
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[4064]:0x56ef3f
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[1400]:0x405a82
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[1673]:0x45dd96
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[647]:0x2d42da
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[181]:0xb1ecf
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[270]:0x188502
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[2034]:0x496ffa
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[6459]:0x6100dc
ha@https://app.mutinywallet.com/assets/index-2414d257.js:2:1271
o@https://app.mutinywallet.com/assets/index-2414d257.js:2:115
promise callback*ma/e.wbg.__wbg_then_f7e06ee3c11698eb@https://app.mutinywallet.com/assets/index-2414d257.js:2:48388
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[3206]:0x524842
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[3413]:0x53802a
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[2497]:0x4d4390
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[5331]:0x5f8abe
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[6459]:0x6100dc
ha@https://app.mutinywallet.com/assets/index-2414d257.js:2:1271
o@https://app.mutinywallet.com/assets/index-2414d257.js:2:115
promise callback*ma/e.wbg.__wbg_then_b2267541e2a73865@https://app.mutinywallet.com/assets/index-2414d257.js:2:48475
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[1417]:0x407fdf
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[1520]:0x4413f4
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[181]:0xb0bab
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[270]:0x188502
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[2034]:0x496ffa
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[6459]:0x6100dc
ha@https://app.mutinywallet.com/assets/index-2414d257.js:2:1271
o@https://app.mutinywallet.com/assets/index-2414d257.js:2:115
promise callback*ma/e.wbg.__wbg_then_f7e06ee3c11698eb@https://app.mutinywallet.com/assets/index-2414d257.js:2:48388
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[3206]:0x524842
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[3413]:0x53802a
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[2497]:0x4d4390
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[5331]:0x5f8abe
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[6459]:0x6100dc
ha@https://app.mutinywallet.com/assets/index-2414d257.js:2:1271
o@https://app.mutinywallet.com/assets/index-2414d257.js:2:115
promise callback*ma/e.wbg.__wbg_then_b2267541e2a73865@https://app.mutinywallet.com/assets/index-2414d257.js:2:48475
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[1417]:0x407fdf
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[409]:0x220fdc
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[181]:0xb0ad5
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[270]:0x188502
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[2034]:0x496ffa
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[6459]:0x6100dc
ha@https://app.mutinywallet.com/assets/index-2414d257.js:2:1271
o@https://app.mutinywallet.com/assets/index-2414d257.js:2:115
promise callback*ma/e.wbg.__wbg_then_f7e06ee3c11698eb@https://app.mutinywallet.com/assets/index-2414d257.js:2:48388
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[3206]:0x524842
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[3413]:0x53802a
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[5555]:0x5fcf34
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[980]:0x396267
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[4659]:0x5e50b5
ua@https://app.mutinywallet.com/assets/index-2414d257.js:2:475
o@https://app.mutinywallet.com/assets/index-2414d257.js:2:115
EventHandlerNonNull*ma/e.wbg.__wbg_setonsuccess_f518a37d8228a576@https://app.mutinywallet.com/assets/index-2414d257.js:2:44806
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[6308]:0x60ed37
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[324]:0x1c8c59
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[1013]:0x39f6c4
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[270]:0x187e23
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[2034]:0x496ffa
@https://app.mutinywallet.com/assets/mutiny_wasm_bg-126c236f.wasm:wasm-function[6459]:0x6100dc
ha@https://app.mutinywallet.com/assets/index-2414d257.js:2:1271
o@https://app.mutinywallet.com/assets/index-2414d257.js:2:115
mutiny_wasm_bg-126c236f.wasm:5471813:1
TonyGiorgio commented 1 year ago

Here are a few workarounds:

Web Workers: If your setupMutinyWallet is doing some heavy computation and that's what's causing the script to timeout, you could consider moving that computation to a Web Worker. Web Workers run in a separate thread and don't block the main thread, so they won't cause the browser to become unresponsive and terminate your script.

Async/Await with small delays: If your setupMutinyWallet involves looping through a large array or doing some other operation many times, you can try breaking up that operation into smaller parts and using setTimeout or asynchronous functions to allow the browser to update in between each part. This can prevent the browser from thinking that your script is unresponsive and terminating it.

Progressive loading: If your setupMutinyWallet is loading a lot of data, consider loading it in smaller chunks and updating the user interface after each chunk. This can keep the browser responsive and prevent your script from being terminated.

Unfortunately, if the browser is terminating your script, there's no way to catch that event or to know when it happens from within the script itself. You would have to use one of the above workarounds to prevent the browser from terminating your script in the first place.