Alby Hub Desktop crashes if the LDK port is already in use
- Dominant language
- TypeScript
- Stars
- 280
- Forks
- 132
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 11
Description
As the title says, currently the desktop version of Alby Hub crashes if port 9735 (the LDK port) is used by some other LN-related program such as Electrum. I don't know if this happens on the Server build.
Here is the full stack trace:
```
zenulabidin@zerstrorer ~/Downloads % RUST_BACKTRACE=full ./albyhub-Desktop-Linux/bin/Alby\ Hub
INFO[0000] Alby Hub starting in WAILS mode
{"level":"info","msg":"AlbyHub v1.13.0","time":"2025-01-30T12:32:50Z"}
{"level":"info","msg":"No workdir specified, using default","time":"2025-01-30T12:32:50Z","workdir":"/home/zenulabidin/.local/share/albyhub"}
Overriding existing handler for signal 10. Set JSC_SIGNAL_FOR_GC if you want WebKit to use a different signal
{"level":"info","me":{"identifier":"eQMWJGshfPnTrheU0Gtd","nostr_pubkey":"","lightning_address":"effulgentblossom5895@getalby.com","email":"ali@notatether.com","name":"Zenul_Abidin","avatar":"","keysend_pubkey":"030a58b8653d32b99200a2334cfe913e51dc7d155aa0116c176657a4f1722677a3","shared_node":true,"hub":{"name":""},"subscription":{"buzz":false}},"msg":"Alby me response","time":"2025-01-30T12:32:51Z"}
{"level":"info","msg":"Launching LN Backend: LDK","time":"2025-01-30T12:33:36Z"}
{"level":"info","listening_addresses":["0.0.0.0:9736","[::]:9736"],"migrate_storage":"","msg":"Creating node","time":"2025-01-30T12:33:36Z","vss_enabled":false}
thread 'tokio-runtime-worker' panicked at src/lib.rs:347:45:
Failed to bind to listen address/port - is something else already listening on it?
stack backtrace:
{"level":"info","msg":"Started LDK node. Syncing wallet...","nodeId":"030d5f918eb5c54e1d91d50b2b25c8112db6da27afa49e6d647d786f1e93c01f6f","status":{"IsRunning":true,"IsListening":false,"CurrentBestBlock":{"BlockHash":"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f","Height":0},"LatestLightningWalletSyncTimestamp":null,"LatestOnchainWalletSyncTimestamp":null,"LatestFeeRateCacheUpdateTimestamp":1738240416,"LatestRgsSnapshotTimestamp":null,"LatestNodeAnnouncementBroadcastTimestamp":null,"LatestChannelMonitorArchivalHeight":null},"time":"2025-01-30T12:33:37Z"}
0: 0x7f0969007635 - ::fmt::h1b9dad2a88e955ff
1: 0x7f096902e09b - core::fmt::write::h4b5a1270214bc4a7
2: 0x7f096900401f - std::io::Write::write_fmt::hd04af345a50c312d
3: 0x7f0969008771 - std::panicking::default_hook::{{closure}}::h96ab15e9936be7ed
4: 0x7f096900844c - std::panicking::default_hook::h3cacb9c27561ad33
5: 0x7f0969008dd1 - std::panicking::rust_panic_with_hook::hfe205f6954b2c97b
6: 0x7f0969008c03 - std::panicking::begin_panic_handler::{{closure}}::h6cb44b3a50f28c44
7: 0x7f0969007af9 - std::sys::backtrace::__rust_end_short_backtrace::hf1c1f2a92799bb0e
8: 0x7f09690088c4 - rust_begin_unwind
9: 0x7f0968243803 - core::panicking::panic_fmt::h3d8fc78294164da7
10: 0x7f0968920ff2 - ldk_node::Node::start_with_runtime::{{closure}}::h94e5d6e76441a175
11: 0x7f09688fac4b - tokio::runtime::task::raw::poll::hcc6de2a1cc657541
[3] 38742 IOT instruction (core dumped) RUST_BACKTRACE=full ./albyhub-Desktop-Linux/bin/Alby\ Hub
```
It would be nice if the application displayed an error message instead. Something like "Port 9735 is in use by another application. Please close it or start Alby Hub with a different port" along with a Quit button or something similar. It would be more descriptive and also people won't think that it's some sort of bug in the program.
edit: the stack trace references port 9736 because I ran Hub with a custom port. But this can also be reproduced with the default port 9735.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the desktop startup failure with port 9735 occupied, then inspect src/lib.rs around line 347 and the desktop startup path. The work is done when the port-bind failure is handled without a crash and the application shows a clear error with a way to quit or choose another port.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, typescript
- Domain
- backend, desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100