Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App doesn't terminate gracefully and crashes #337

Open
zehnm opened this issue Nov 21, 2019 · 5 comments
Open

App doesn't terminate gracefully and crashes #337

zehnm opened this issue Nov 21, 2019 · 5 comments
Assignees
Labels
bug
Milestone

Comments

@zehnm
Copy link
Member

@zehnm zehnm commented Nov 21, 2019

Expected behavior
When running the app on Linux, macOS or Windows it can be gracefully terminated without throwing errors.

Current behavior
On macOs an error dialog is shown when closing the app saying it crashed.
Error messages are shown in the console on every platform.

Detailed description
Console messages:

FATAL: yio QThread: Destroyed while thread is still running (/0)
19:53:54: The program has unexpectedly finished.
19:53:54: The process was ended forcefully.

Crash dialog on macOS:
Screenshot 2019-11-21 at 20 02 32

@zehnm

This comment has been minimized.

Copy link
Member Author

@zehnm zehnm commented Nov 22, 2019

One issue is in BluetoothArea:

  • BluetoothThread needs to be closed properly in BluetoothArea's deconstructor
@zehnm

This comment has been minimized.

Copy link
Member Author

@zehnm zehnm commented Nov 22, 2019

Quick fix without checking if the thread has been started or not:

BluetoothArea::~BluetoothArea() {
    m_thread.exit();
    m_thread.wait();
}

The Bluetooth thread exits and the FATAL QThread error is gone, BUT the app crashes now with a segmentation fault within the Logger because the instance has already been deleted but other parts are still active and continue logging...

@ChristianRiedl could you make the Logger instance a global object, or do you have a better idea?
Right now it's created in main() and is therefore removed too early during application shutdown.

@zehnm

This comment has been minimized.

Copy link
Member Author

@zehnm zehnm commented Nov 22, 2019

Next issue: DockThread in DockBase (same as BluetoothThread)

@zehnm zehnm self-assigned this Nov 22, 2019
@zehnm zehnm added the bug label Nov 22, 2019
@martonborzak

This comment has been minimized.

Copy link
Member

@martonborzak martonborzak commented Nov 22, 2019

@zehnm

This comment has been minimized.

Copy link
Member Author

@zehnm zehnm commented Nov 22, 2019

Got everything terminating gracefully without errors. After cleaning up the Wifi rewrite branch I'll add it to the dev branches of remote-software & integration projects.

zehnm added a commit to YIO-Remote/integration.dock that referenced this issue Nov 22, 2019
Terminate thread for clean shutdown of remote app.
Part of YIO-Remote/remote-software#337
zehnm added a commit that referenced this issue Nov 22, 2019
Fixes `FATAL: yio QThread: Destroyed while thread is still running`.
Part of #337
zehnm added a commit to YIO-Remote/integration.home-assistant that referenced this issue Nov 22, 2019
Terminate thread for clean shutdown of remote app.
Part of YIO-Remote/remote-software#337
zehnm added a commit to YIO-Remote/integration.dock that referenced this issue Nov 22, 2019
Better limit the maximum amount of time to wait for thread termination.
Otherwise the app might get stuck shutting down.
Part of YIO-Remote/remote-software#337
zehnm added a commit that referenced this issue Nov 22, 2019
Better limit the maximum amount of time to wait for thread termination.
Otherwise the app might get stuck shutting down.
Part of #337
zehnm added a commit to YIO-Remote/integration.homey that referenced this issue Nov 22, 2019
Terminate thread for clean shutdown of remote app.
Part of YIO-Remote/remote-software#337
@martonborzak martonborzak added this to Backlog in YIO Remote software via automation Nov 26, 2019
@martonborzak martonborzak added this to the Release 0.2 milestone Nov 26, 2019
@zehnm zehnm moved this from Backlog to Implementation in YIO Remote software Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
YIO Remote software
  
Implementation
2 participants
You can’t perform that action at this time.