klogg icon indicating copy to clipboard operation
klogg copied to clipboard

Windows11: Immediate crash on file open dialog

Open ankrman opened this issue 3 years ago • 9 comments

Klogg crashes as soon as I run the open file dialog. It doesn't show any kind of file structure, it's just the grid for the dialog (left folder/right files but all empty).

I'm on a german Win11, the only version that is not crashing is 17.12

Below a log with log level 4

2022-06-13T16:59:33 info [18888] [`anonymous-namespace'::checkCrashpadReports@181] Pending reports 0
2022-06-13T16:59:33 info [18888] [`anonymous-namespace'::logSentry@93] using database path "%S"
2022-06-13T16:59:33 info [18888] [`anonymous-namespace'::logSentry@93] starting backend
2022-06-13T16:59:33 info [18888] [`anonymous-namespace'::logSentry@93] starting crashpad backend with handler "%S"
2022-06-13T16:59:33 info [18888] [`anonymous-namespace'::logSentry@93] using minidump url ""
2022-06-13T16:59:33 info [18888] [`anonymous-namespace'::logSentry@93] started crashpad client handler
2022-06-13T16:59:33 info [18888] [`anonymous-namespace'::logSentry@93] discarding envelope due to missing user consent
2022-06-13T16:59:33 info [18888] [CrashHandler::{ctor}::::operator()@265] Process stats: memory - 34281730048
2022-06-13T16:59:33 info [18888] [CrashHandler::{ctor}::::operator()@265] Process stats: cpuInstructions - 254
2022-06-13T16:59:33 info [18888] [CrashHandler::{ctor}::::operator()@265] Process stats: concurrency - 16
2022-06-13T16:59:33 info [18888] [main@142] Klogg instance 0, tbbmalloc 2021.7, default concurrency 16
2022-06-13T16:59:33 info [18888] [StyleManager::applyStyle@74] Setting style to "WindowsVista"
2022-06-13T16:59:33 info [18888] [SessionInfo::retrieveFromStorage@64] Loaded settings for window session "b58efde4704f47bc8181ad172bd7c9c7"
2022-06-13T16:59:33 info [18888] [SessionInfo::retrieveFromStorage@64] Loaded settings for window session "b58efde4704f47bc8181ad172bd7c9c7"
2022-06-13T16:59:33 info [18888] [WindowSession::WindowSession@213] created session for "b58efde4704f47bc8181ad172bd7c9c7"
2022-06-13T16:59:33 info [18888] [SessionInfo::retrieveFromStorage@64] Loaded settings for window session "b58efde4704f47bc8181ad172bd7c9c7"
2022-06-13T16:59:33 info [18888] [HighlighterSetCollection::retrieveFromStorage@553] Loaded 1 highlighter sets
2022-06-13T16:59:33 info [18888] [KloggApp::newWindow@244] Window 0x286b0623db8 created
2022-06-13T16:59:33 info [18888] [SessionInfo::retrieveFromStorage@64] Loaded settings for window session "b58efde4704f47bc8181ad172bd7c9c7"
2022-06-13T16:59:33 info [18888] [SessionInfo::retrieveFromStorage@64] Loaded settings for window session "b58efde4704f47bc8181ad172bd7c9c7"
2022-06-13T16:59:33 info [18888] [MainWindow::logScreenInfo@2000] screen changed for 0
2022-06-13T16:59:33 info [18888] [MainWindow::logScreenInfo@2005] screen name "DELL S2721DGF"
2022-06-13T16:59:33 info [18888] [MainWindow::logScreenInfo@2006] screen size 2560x1440
2022-06-13T16:59:33 info [18888] [MainWindow::logScreenInfo@2007] screen ratio 1
2022-06-13T16:59:33 info [18888] [MainWindow::logScreenInfo@2008] screen logical dpi 96
2022-06-13T16:59:33 info [18888] [MainWindow::logScreenInfo@2009] screen physical dpi 108.888
2022-06-13T16:59:33 info [18888] [KloggApp::onWindowActivated@257] Window MainWindow(0x286b06f2400) activated

ankrman avatar Jun 13 '22 15:06 ankrman

Thanks for reporting this. Looks like there is some incompatibility with TBB malloc memory allocator and Windows 11. @ankrman could you set environmental variable TBB_MALLOC_DISABLE_REPLACEMENT to 1 and try one more time?

variar avatar Jun 13 '22 15:06 variar

Hah, after I added the env var it works like a charm 👍

ankrman avatar Jun 13 '22 16:06 ankrman

Great! The issue has been investigated here: https://github.com/microsoft/mimalloc/issues/498. Apparently this is a questionable code in in shell32 where mallocd (or newd) memory is directly deallocated using RtlFreeHeap (which goes wrong when the allocator is not using RtlAllocHeap). Might be resolved in some future Windows update.

I don't want to disable TBB malloc for everyone because it does provide a noticeable speedup. I've added a note to release description on how to mitigate the issue.

variar avatar Jun 13 '22 17:06 variar

Sounds reasonable, thanks for your explanation. I can live with that workaround, glad that klogg is finally running on my win 11 machine.

Thanks for your quick response, highly appreciated.

ankrman avatar Jun 13 '22 19:06 ankrman

Did a fresh install of Win 11 to VirtualBox VM. Crash is not happening with Qt6 build. So the issue seems to be less frequent. Could it be that you have OneDrive or some other explorer extension installed that adds features to explorer or context menu? All such "shell" extensions are loaded into a process that creates an open file dialog, and some of them might confuse TBB memory allocation redirection. It would be nice to figure out which one is incompatible with klogg.

variar avatar Jun 13 '22 21:06 variar

The only thing I can think about is MS PowerToys (most current version) with its explorer addons (https://docs.microsoft.com/en-us/windows/powertoys/file-explorer). Besides that only stuff in the context menu, pathcopycopy, notepad++, sandboxie plus...

Attached a report (rename to .html) about non-default extensions...

report.txt .

ankrman avatar Jun 14 '22 06:06 ankrman

I have this systematic crash too (latest 22.06.0.1289 QT6 version, windows 11, Powertoys, OneDrive, Notepad++, Defender, Beyond Compare in context menu). Haven't tried the TBB_MALLOC_DISABLE_REPLACEMENT workaround yet, hope for a (MS?) fix :)

wiz0u avatar Aug 20 '22 18:08 wiz0u

Hi, sorry for that. The problem is with the way how memory allocation is done in Windows shell library. I don't think that will be fixed any time soon. The fix for now is disabling TBB memory allocation override for klogg. Might be fixed in future TBB versions.

variar avatar Aug 20 '22 19:08 variar

TBB_MALLOC_DISABLE_REPLACEMENT to 1 worked

wiz0u avatar Aug 20 '22 21:08 wiz0u

Recent builds (23.06) don't use global malloc override anymore as it causes issues like this one.

variar avatar Jul 01 '23 10:07 variar