Chia-Network/chia-blockchain

[Bug] GUI can't start if any components are already running

chia-rschmidt opened this issue · 1 comments

What happened?

Attempting to close my GUI after being open for a couple of days randomly caused an issue where it got stuck on the Closing down services window when stopping the full node. After force stopping the GUI and attempting to reopen it, it got stuck on the Starting services page when starting the Full Node. I'm not positive what caused the issue with closing the GUI originally, but I was able to recreate the issue by closing the GUI window while it is on the Closing down services page. Attached are the logs from the first issue along with a recreation of the issue.

Steps to recreate:

  1. Attempt to close GUI
  2. While on Closing down services page, quickly press the x in the top right or use ctrl + c to close it without the process completing.
  3. Attempt to open/close the GUI.

Screenshot from 2024-08-18 17-58-55

Screenshot from 2024-08-17 17-19-47

Screenshot from 2024-08-17 17-16-58

No startup and plot nft stuck.log
Random crash.log

Version

2.4.3-rc3

What platform are you using?

Linux

What ui mode are you using?

GUI

Relevant log output

2024-08-17T17:19:13.970 full_node full_node               : ERROR    full_node: already running
2024-08-17T17:19:13.975 full_node chia.server.start_service: ERROR    fatal uncaught exception: ValueError: full_node: already running
Traceback (most recent call last):
  File "chia/util/lock.py", line 42, in acquire
  File "filelock/_api.py", line 341, in acquire
filelock._error.Timeout: The file lock '/home/chia/.chia/testnet/run/full_node.lock' could not be acquired.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "chia/server/start_service.py", line 201, in run
  File "chia/util/lock.py", line 29, in __enter__
  File "chia/util/lock.py", line 44, in acquire
chia.util.lock.LockfileError: The file lock '/home/chia/.chia/testnet/run/full_node.lock' could not be acquired.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "chia/util/log_exceptions.py", line 20, in log_exceptions
  File "chia/server/start_service.py", line 328, in async_run
  File "asyncio/runners.py", line 44, in run
  File "asyncio/base_events.py", line 649, in run_until_complete
  File "chia/server/start_full_node.py", line 85, in async_main
  File "chia/server/start_service.py", line 206, in run
ValueError: full_node: already running

Hey @chia-rschmidt , this is expected behavior as the GUI is unable to bind onto processes that it is unaware and unable to start new processes as the needed ports are already being used by the other instance.

One would need to purge any ghost processes either via a reboot, using the task manager, or by running chia stop all -d from the cli in order to launch the GUI after the processes fail to close successfully.

You will notice that when closing the GUI with the close window x there is an option to leave services running in the background, this will allow one to close the gui, leave services running, then reopen the GUI and bind onto those processes as it is aware of them via this process. If there are issues with this leave services running method please let us know otherwise I am going to close this ticket as it is a known issue for a failed closing of the chia processes.