Summary: | Krita constantly creates and removes native threads | ||
---|---|---|---|
Product: | [Applications] krita | Reporter: | Andrew Savonichev <andrew.savonichev> |
Component: | General | Assignee: | Krita Bugs <krita-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | andrew.savonichev, halla |
Priority: | NOR | ||
Version: | git master (please specify the git hash!) | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/graphics/krita/commit/8b9ac2512e9ec12f52411c86f299ea3550936a0a | Version Fixed In: | |
Sentry Crash Report: |
Description
Andrew Savonichev
2016-03-17 20:53:45 UTC
Weird... I cannot reproduce it with 3.0 on opensuse! Which version of Qt do you have? Qt 5.5.1-r1 proposed patch: https://phabricator.kde.org/D1166 Okay -- let's ping dmitry on Monday and see what he thinks. The patch looks good to me, but this isn't quite my area of expertise. Hi Andrew, Did you investigate further? What were your findings. Any news? Hi Boud, Sorry, was not able to finish it for a long time. I'll make an appropriate fix and update the review request. That would be awesome, thanks! Git commit 9c34fef3320983c8e0542363121035eab225cd29 by Dmitry Kazakov, on behalf of Andrew Savonichev. Committed on 18/08/2016 at 06:59. Pushed by dkazakov into branch 'master'. Summary: KisUpdaterContext::waitForDone() method must lock context and wait untill all threads finish their current tasks. We cannot call QThreadPool.waitForDone() to do this, because after waiting it removes all threads from the pool. Test Plan: Verified that no extra threads created: 8 for global thread pool and 8 for KisUpdaterContext (gdb) info threads Id Target Id Frame 22 Thread 0x7fff8cff9700 (LWP 18481) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 21 Thread 0x7fff8d7fa700 (LWP 18480) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 20 Thread 0x7fff8dffb700 (LWP 18479) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 19 Thread 0x7fff8e7fc700 (LWP 18478) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 18 Thread 0x7fff8effd700 (LWP 18477) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 17 Thread 0x7fff8f7fe700 (LWP 18476) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 16 Thread 0x7fff8ffff700 (LWP 18475) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 15 Thread 0x7fff9bfff700 (LWP 18474) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 13 Thread 0x7fffb8ff9700 (LWP 18471) "QFileInfoGather" 0x00007fffef6e291f in pthread_cond_wait () from /lib64/libpthread.so.0 12 Thread 0x7fffb97fa700 (LWP 18470) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 11 Thread 0x7fffb9ffb700 (LWP 18469) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 10 Thread 0x7fffba7fc700 (LWP 18468) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 9 Thread 0x7fffbaffd700 (LWP 18467) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 8 Thread 0x7fffbb7fe700 (LWP 18466) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 7 Thread 0x7fffbbfff700 (LWP 18465) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 6 Thread 0x7fffc8f8a700 (LWP 18464) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 5 Thread 0x7fffc978b700 (LWP 18463) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 4 Thread 0x7fffca38d700 (LWP 18462) "KisTileDataSwap" 0x00007fffef6e291f in pthread_cond_wait () from /lib64/libpthread.so.0 3 Thread 0x7fffcab8e700 (LWP 18461) "KisTileDataPool" 0x00007fffef6e291f in pthread_cond_wait () from /lib64/libpthread.so.0 2 Thread 0x7fffe0843700 (LWP 18460) "QXcbEventReader" 0x00007ffff16a33ed in poll () from /lib64/libc.so.6 * 1 Thread 0x7fffe7f3f7c0 (LWP 18456) "krita" 0x00007ffff16a33ed in poll () from /lib64/libc.so.6 Reviewers: dkazakov Reviewed By: dkazakov Subscribers: fazek Differential Revision: https://phabricator.kde.org/D1166 M +10 -2 libs/image/kis_update_scheduler.cpp M +89 -14 libs/image/kis_updater_context.cpp M +14 -0 libs/image/kis_updater_context.h M +14 -0 libs/image/tests/kis_strokes_queue_test.cpp M +2 -0 libs/image/tests/kis_updater_context_test.cpp http://commits.kde.org/krita/9c34fef3320983c8e0542363121035eab225cd29 Git commit 9c34fef3320983c8e0542363121035eab225cd29 by Dmitry Kazakov, on behalf of Andrew Savonichev. Committed on 18/08/2016 at 06:59. Pushed by dkazakov into branch 'master'. Summary: KisUpdaterContext::waitForDone() method must lock context and wait untill all threads finish their current tasks. We cannot call QThreadPool.waitForDone() to do this, because after waiting it removes all threads from the pool. Test Plan: Verified that no extra threads created: 8 for global thread pool and 8 for KisUpdaterContext (gdb) info threads Id Target Id Frame 22 Thread 0x7fff8cff9700 (LWP 18481) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 21 Thread 0x7fff8d7fa700 (LWP 18480) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 20 Thread 0x7fff8dffb700 (LWP 18479) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 19 Thread 0x7fff8e7fc700 (LWP 18478) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 18 Thread 0x7fff8effd700 (LWP 18477) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 17 Thread 0x7fff8f7fe700 (LWP 18476) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 16 Thread 0x7fff8ffff700 (LWP 18475) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 15 Thread 0x7fff9bfff700 (LWP 18474) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 13 Thread 0x7fffb8ff9700 (LWP 18471) "QFileInfoGather" 0x00007fffef6e291f in pthread_cond_wait () from /lib64/libpthread.so.0 12 Thread 0x7fffb97fa700 (LWP 18470) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 11 Thread 0x7fffb9ffb700 (LWP 18469) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 10 Thread 0x7fffba7fc700 (LWP 18468) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 9 Thread 0x7fffbaffd700 (LWP 18467) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 8 Thread 0x7fffbb7fe700 (LWP 18466) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 7 Thread 0x7fffbbfff700 (LWP 18465) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 6 Thread 0x7fffc8f8a700 (LWP 18464) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 5 Thread 0x7fffc978b700 (LWP 18463) "Thread (pooled)" 0x00007fffef6e2cc8 in pthread_cond_timedwait () from /lib64/libpthread.so.0 4 Thread 0x7fffca38d700 (LWP 18462) "KisTileDataSwap" 0x00007fffef6e291f in pthread_cond_wait () from /lib64/libpthread.so.0 3 Thread 0x7fffcab8e700 (LWP 18461) "KisTileDataPool" 0x00007fffef6e291f in pthread_cond_wait () from /lib64/libpthread.so.0 2 Thread 0x7fffe0843700 (LWP 18460) "QXcbEventReader" 0x00007ffff16a33ed in poll () from /lib64/libc.so.6 * 1 Thread 0x7fffe7f3f7c0 (LWP 18456) "krita" 0x00007ffff16a33ed in poll () from /lib64/libc.so.6 Reviewers: dkazakov Reviewed By: dkazakov Subscribers: fazek Differential Revision: https://phabricator.kde.org/D1166 M +10 -2 libs/image/kis_update_scheduler.cpp M +89 -14 libs/image/kis_updater_context.cpp M +14 -0 libs/image/kis_updater_context.h M +14 -0 libs/image/tests/kis_strokes_queue_test.cpp M +2 -0 libs/image/tests/kis_updater_context_test.cpp http://commits.kde.org/krita/9c34fef3320983c8e0542363121035eab225cd29 Git commit 39fcfac8281d4d0bf100d4c15460fa2a2bc998ab by Dmitry Kazakov. Committed on 29/01/2022 at 11:47. Pushed by dkazakov into branch 'master'. Fix Krita discarding native threads every couple of seconds For years Krita has been spawning native threads carelessly. It happened because of the implementation of QThreadPool::waitForDone(), which discards threads on every successful call. We once had a patch for that (9c34fef3320983c8e0542363121035eab225cd29), but it has been reverted due to deadlock regressions it introduced. This patch adds a bit different implementation of the waiting strategy, so (I hope) it won't cause any deadlocks. Related: bug 367901 M +13 -0 libs/image/kis_update_job_item.h M +29 -4 libs/image/kis_updater_context.cpp M +7 -0 libs/image/kis_updater_context.h https://invent.kde.org/graphics/krita/commit/39fcfac8281d4d0bf100d4c15460fa2a2bc998ab Git commit 8b9ac2512e9ec12f52411c86f299ea3550936a0a by Dmitry Kazakov. Committed on 23/02/2022 at 08:48. Pushed by dkazakov into branch 'krita/5.0'. Fix Krita discarding native threads every couple of seconds For years Krita has been spawning native threads carelessly. It happened because of the implementation of QThreadPool::waitForDone(), which discards threads on every successful call. We once had a patch for that (9c34fef3320983c8e0542363121035eab225cd29), but it has been reverted due to deadlock regressions it introduced. This patch adds a bit different implementation of the waiting strategy, so (I hope) it won't cause any deadlocks. Related: bug 367901 M +13 -0 libs/image/kis_update_job_item.h M +29 -4 libs/image/kis_updater_context.cpp M +7 -0 libs/image/kis_updater_context.h https://invent.kde.org/graphics/krita/commit/8b9ac2512e9ec12f52411c86f299ea3550936a0a |