-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Do not crash on GUI shutdown #5288
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
Do not crash on GUI shutdown #5288
Conversation
|
bt from gdb: |
|
The The An improvement would be to stop and wait the threads in parallel. But that is out of scope. |
Or much better to use existing libraries |
What? Qt is an "existing library". The actual problem is that you are trying to terminate a thread which has already finished. It is a race condition. So It is strange though that your initial error says
So for now I would go with We should also file a bug report with Qt as it only mentions that it might leads to inconsistent states but not outright crashes. |
I told about 3rd party thread pools and parallel execution, like QThreadPool, or TBB library, or execution policy in STL. I see, method which runs event loop for thread is overridden and quit event goes to nothing. And CheckThread::mState changes not atomically in method stop(). |
I have a doubt about that. That means all memory and resources owned by the thread will leak right? |
Seems so. I believe this code should be refactored, as I mentioned before. But at least I just want to avoid annoying crashes on exit and tons of coredump files. Will rename PR |
|
I would say this PR is an improvement so I think it is merge-able. But I wonder if it still works as we want. Could you please tell me what happens.. I assume the |
|
The changes improve things. See #5269 (comment) for some notes on the overall issue. |
|
There is now a merge conflict. If you resolve that I think we can merge. |
4060945 to
fbc3a79
Compare
Seems current code for worker threads termination is too brutal which leads to crash on termination:
Seems better to use
quit()andwait(), like in an example: https://doc.qt.io/qt-6/qthread.html#detailstested: Ubuntu Linux 20