holochain / launcher-tauri

Desktop launcher to install and use Holochain apps locally
262 stars 21 forks source link

Force quitting launcher on MacOS leaves conductors running and Re-launch then fails. #82

Open zippy opened 1 year ago

zippy commented 1 year ago

Describe the bug If you force quit the launcher on MacOS, conductor processes are left running, and then on restarting the launcher you get this error:

ERROR - Error launching Holochain v0.0.162: Error launching Holochain: Could not initialize conductor: Unknown Fatal Panic: Unknown fatal panic when trying to initialize conductor. See log file for details.

To Reproduce

  1. Open the launcher.
  2. Force quit the launcher from the task bar
  3. Re-open the a luncher

Expected behavior That on re-launch it would still work!

Logs

[2022-10-03T21:45:47.200238+01:00] INFO - Launched holochain
[2022-10-03T21:45:47.200379+01:00] INFO - LaunchHolochainProcessState::InitializeConductorError
[2022-10-03T21:45:47.200706+01:00] ERROR - Error launching Holochain v0.0.162: Error launching Holochain: `Could not initialize conductor: `Unknown Fatal Panic: `Unknown fatal panic when trying to initialize conductor. See log file for details.```
[2022-10-03T21:45:52.961611+01:00] INFO - [LAIR] Terminated(TerminatedPayload { code: None, signal: Some(9) })
[2022-10-03T21:45:54.694458+01:00] INFO - Launch setup successful
[2022-10-03T21:45:57.551529+01:00] ERROR - [LAIR] {"error":"InternalSodium"}
[2022-10-03T21:46:01.501428+01:00] INFO - [LAIR] # lair-keystore connection_url # unix:///Users/chatley/Library/Application%20Support/lair/0.2/socket?k=NUf2EiIN7COlAlwCkBnI1yNjWOWAie5RnvdrKPbsPCE #
[2022-10-03T21:46:01.501487+01:00] INFO - [LAIR] # lair-keystore running #
[2022-10-03T21:46:01.520868+01:00] INFO - Launched lair-keystore
[2022-10-03T21:46:02.330173+01:00] INFO - [HOLOCHAIN v0.0.162] Oct 03 21:46:02.329  WARN kitsune_p2p::spawn::actor: received gossip for unhandled space: KitsuneSpace(0xe40afad2c1230c4e34e80dfeeaf2bd8232cd9747bd49a8b7e2502510d323f1e63bed3169)
[2022-10-03T21:46:05.466792+01:00] INFO - [HOLOCHAIN v0.0.162] FATAL PANIC PanicInfo {
[2022-10-03T21:46:05.466984+01:00] INFO - [HOLOCHAIN v0.0.162]     payload: Any { .. },
[2022-10-03T21:46:05.466999+01:00] INFO - [HOLOCHAIN v0.0.162]     message: Some(
[2022-10-03T21:46:05.467008+01:00] INFO - [HOLOCHAIN v0.0.162]         Could not initialize Conductor from configuration: InterfaceError(WebsocketError(Io(Os { code: 48, kind: AddrInUse, message: "Address already in use" }))),
[2022-10-03T21:46:05.467016+01:00] INFO - [HOLOCHAIN v0.0.162]     ),
[2022-10-03T21:46:05.467023+01:00] INFO - [HOLOCHAIN v0.0.162]     location: Location {
[2022-10-03T21:46:05.467032+01:00] INFO - [HOLOCHAIN v0.0.162]         file: "/Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/holochain-0.0.162/src/bin/holochain/main.rs",
[2022-10-03T21:46:05.467061+01:00] INFO - [HOLOCHAIN v0.0.162]         line: 170,
[2022-10-03T21:46:05.467069+01:00] INFO - [HOLOCHAIN v0.0.162]         col: 10,
[2022-10-03T21:46:05.467080+01:00] INFO - [HOLOCHAIN v0.0.162]     },
[2022-10-03T21:46:05.467091+01:00] INFO - [HOLOCHAIN v0.0.162]     can_unwind: true,
[2022-10-03T21:46:05.467098+01:00] INFO - [HOLOCHAIN v0.0.162] }
[2022-10-03T21:46:05.545614+01:00] INFO - [HOLOCHAIN v0.0.162] Well, this is embarrassing.
[2022-10-03T21:46:05.545654+01:00] INFO - [HOLOCHAIN v0.0.162] 
[2022-10-03T21:46:05.545664+01:00] INFO - [HOLOCHAIN v0.0.162] holochain had a problem and crashed. To help us diagnose the problem you can send us a crash report.
[2022-10-03T21:46:05.545671+01:00] INFO - [HOLOCHAIN v0.0.162] 
[2022-10-03T21:46:05.545680+01:00] INFO - [HOLOCHAIN v0.0.162] We have generated a report file at "/var/folders/kr/1rbjvb8n1fbf_1z1257rxv480000gq/T/report-228004bd-3fb5-462c-a7a3-29e8d0f9a48e.toml". Submit an issue or email with the subject of "holochain Crash Report" and include the report as an attachment.
[2022-10-03T21:46:05.545687+01:00] INFO - [HOLOCHAIN v0.0.162] 
[2022-10-03T21:46:05.545694+01:00] INFO - [HOLOCHAIN v0.0.162] - Homepage: https://github.com/holochain/holochain
[2022-10-03T21:46:05.545701+01:00] INFO - [HOLOCHAIN v0.0.162] - Authors: Holochain Core Dev Team <devcore@holochain.org>
[2022-10-03T21:46:05.545707+01:00] INFO - [HOLOCHAIN v0.0.162] 
[2022-10-03T21:46:05.545714+01:00] INFO - [HOLOCHAIN v0.0.162] We take privacy seriously, and do not perform any automated error collection. In order to improve the software, we rely on people to submit reports.
[2022-10-03T21:46:05.545720+01:00] INFO - [HOLOCHAIN v0.0.162] 
[2022-10-03T21:46:05.545726+01:00] INFO - [HOLOCHAIN v0.0.162] Thank you kindly!
[2022-10-03T21:46:05.565104+01:00] INFO - [HOLOCHAIN v0.0.162] Terminated(TerminatedPayload { code: Some(101), signal: None })
[2022-10-03T21:46:05.565151+01:00] INFO - Launched holochain
[2022-10-03T21:46:05.565166+01:00] INFO - LaunchHolochainProcessState::InitializeConductorError
[2022-10-03T21:46:05.565219+01:00] ERROR - Error launching Holochain v0.0.162: Error launching Holochain: `Could not initialize conductor: `Unknown Fatal Panic: `Unknown fatal panic when trying to initialize conductor. See log file for details.

Desktop (please complete the following information):

matthme commented 1 year ago

This might actually be a tricky problem because it may be a limitation by tauri. Just found this statement in the tauri discord:

we can't catch task manager killing the app so we can't clean up the sidecar either

(https://discord.com/channels/616186924390023171/1008677139807219753/1008680327914463312)

The holochain binaries run as sidecar binaries and apparently can't clean up sidecar binaries when the main process is being manually killed. I'm not sure what's the ideal way to deal with this. Two things come to my mind:

matthme commented 1 year ago

I added a "restart" item in the menu for now that cleans up all holochain processes and restarts the launcher. It does not solve the underlying issue but provides a closer path for the end-user to kill the holochain processes than going via the task-manager.

Connoropolous commented 1 year ago

this could also be related to this issue that I have logged in holochain/holochain... https://github.com/holochain/holochain/issues/1013

this issue not being fixed is actually one of the multiple reasons that we spun up holochain-runner, which handles SIGINT/SIGKILL signals and shuts down

matthme commented 1 year ago

Thanks @Connoropolous for pointing that out! I just investigated whether this might indeed be the cause here as well but unfortunately the same happens to lair-keystore (just that an orphan lair-keystore process doesn't bother much) so I think it's indeed that Tauri cannot capture the kill signal and therefore cannot clean up the sidecar binaries :/ Since this error is making quite some trouble for people I'll add this error message with the next release:

image

Feedback or suggestions regarding the error message welcome...