Brewtarget / brewtarget

Main brewtarget source code repository.
GNU General Public License v3.0
312 stars 134 forks source link

Import or export xml records crashes 3.0.x Win app #711

Closed Melonbob closed 1 month ago

Melonbob commented 1 year ago

Tested with two Windows machines, win11 v21H2 and win10 v??. This has occurred with releases 3.0.4, 3.0.2, 3.0.1, 3.0.0 on both. Haven't tried 3.0.5 yet, but don't see it listed as a fix or even an issue for this release.

Don't know if I've tried all record sets but recipes, yeasts, ferms, misc, styles all crash, by rt-click and from the menu, with single records and multiple and whole set.

I turned on debug level logs with a clean reinstall of 3.0.4. One I think had a normal shutdown in it.

brewtarget.log

brewtarget_2023_01_04_23_06_50_128.log

matty0ung commented 1 year ago

Hello, Sorry to hear you're hitting problems. I tried to reproduce this issue in a Windows VM with the latest (nightly) code, but it seems to be working OK for me. It might be that one of the recent post-3.0.5 bug-fixes (eg for https://github.com/Brewtarget/brewtarget/issues/695) has solved the problem you're seeing. But it could also be that there is something else different between your set-up and the one I tried on. (Unfortunately I couldn't tell much from the logs because they stop before the crash point, which I'd guess is because Windows is buffering the log writes.) If you get a chance to try the nightly builds, please let us know how you get on. Failing that, there should be a 3.0.6 release soon that you can try.

Melonbob commented 1 year ago

Tried tonight's build and several others. Same results.

matty0ung commented 1 year ago

Thanks for trying that. I appreciate it's frustrating that it's still not working, but you have helped eliminate a fair few possibilities by doing that. I will have a think about other things we can try - either to reproduce the problem on a developer machine or to get more diagnostics out of your system (eg via adding more logging to the code).

matty0ung commented 1 year ago

From the logs you uploaded, it's looking like the crash is inside XercesHelpers::getParameterSettings(), possibly in the call to xercesc::DOMConfiguration::getParameterNames(). I think at this point of the code that the Xerces library should already be loaded and initialised, so I don't think it's a problem loading the DLL.

Is there any info in the Windows Event Viewer that might help us? (If it's not something you've used before, there is eg a how-to at https://kb.blackbaud.com/knowledgebase/Article/75433.)

Melonbob commented 1 year ago

Here's some from win11: w11_bt3.0.4_2023-01-04.txt

w11_bt3.0.5,3.0.5x_2023-01-05.txt

The latter is the 3.0.5 release and several daily builds since it and do not all correspond to your 3.0.x. I can't remember which exact ones they were.

I'll get some from win10 too. Let me know they may be easier to read in .xml, .csv or .evtx

matty0ung commented 1 year ago

Thanks for these.

According to https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55, Exception code: 0x40000015 means STATUS_FATAL_APP_EXIT. AFAICT this along with Event Name: APPCRASH just means some crash or unhandled exception happened and it wasn't one of the circumstances that would result in a less generic error. So I guess it did eliminate some more possibilities, but it doesn't narrow things down quite as much as we might have hoped.

It would be great to get a core dump or a stack trace but I'm not sure how to enable this on Windows. It's possible @mattiasmaahl might know.

I will also have a think about whether we can add more diagnostics.

matty0ung commented 1 year ago

It's also at least possible that this is a packaging issue. If there is some error in the way the package is being built then it would explain why I don't see the problem on my Windows VM where I'm just running what's built from source. When I get some time, I'll try doing an install from packages.

Melonbob commented 1 year ago

Here are the win10: w10_bt3.0.0_2022-10-05.txt

w10_bt3.4.0_2022-12-15.txt

matty0ung commented 1 year ago

Thanks for these. Looks like the content is very similar to the win11 ones.

I can now reproduce the problem, by installing from the package rather than building from source. That's good news because it tells us where to look. The looking may take a while as I'm not as familiar with how to do certain things on Windows as on Linux, but I'll keep plugging away.

matty0ung commented 1 year ago

I've managed to get a rudimentary stack trace with WinDbg. Looks like we're missing symbols for the Brewtarget executable, so I might see if I can get the build process to add them in, which would give us better diagnostics.

 # ChildEBP RetAddr      
00 00d99c28 77d90158     ntdll!NtTerminateProcess+0xc
01 00d99cc8 77d301aa     ntdll!RtlpWaitOnCriticalSection+0x40b58
02 00d99d00 77d2fff9     ntdll!RtlpEnterCriticalSectionContended+0x1aa
03 00d99d0c 75a98e43     ntdll!RtlEnterCriticalSection+0x49
04 00d99d30 75a9b648     winhttp!UnloadProxyApi+0x23
05 00d99d44 75a9b8b9     winhttp!WinHttpClientResolver::Release+0x78
06 00d99d6c 75a9d304     winhttp!WxProxyManager::Release+0x89
07 00d99da8 75aa14c8     winhttp!INTERNET_HANDLE_BASE::~INTERNET_HANDLE_BASE+0x74
08 00d99dfc 6f696cb6     winhttp!WinHttpCloseHandle+0x528
WARNING: Stack unwind information not available. Following frames may be wrong.
09 00d99e0c 6f8f6b39     Qt5Network!ZN9QHostInfo15localDomainNameEv+0x2f06
0a 00d99e1c 6f696dbd     Qt5Core!ZN16QLoggingCategoryD2Ev+0x19
0b 00d99e20 76296f95     Qt5Network!ZN9QHostInfo15localDomainNameEv+0x300d
0c 00d99e2c 6f703f6e     msvcrt!_unlock+0x15
0d 00d99e4c 6f60115c     Qt5Network!ZN5QDtls11qt_metacallEN11QMetaObject4CallEiPPv+0x8fbe
0e 00d99e6c 6f601355     Qt5Network+0x115c
0f 00d99e9c 6f6013ae     Qt5Network+0x1355
10 00d99ecc 77d3de02     Qt5Network+0x13ae
11 00d99f18 77d4d912     ntdll!LdrpCallInitRoutine+0x51
12 00d99fb0 77d4d795     ntdll!LdrShutdownProcess+0x162
13 00d9a080 75f35992     ntdll!RtlExitUserProcess+0xb5
14 00d9a094 76296127     KERNEL32!ExitProcessImplementation+0x12
15 00d9a0a0 76296687     msvcrt!__crtExitProcess+0x17
16 00d9a0e4 762960c1     msvcrt!doexit+0x135
17 00d9a0f8 7628b768     msvcrt!_exit+0x11
18 00d9a428 00820bc2     msvcrt!abort+0xe8
19 00d9a438 0081e1a2     brewtarget+0x420bc2
1a 00d9a468 710c6a02     brewtarget+0x41e1a2
1b 00d9a478 6f35a5d2     libgcc_s_dw2_1!_enable_execute_stack+0x1aa2
1c 00d9a818 005c92ca     libxerces_c_3_2!ZNK11xercesc_3_218DOMXPathResultImpl14getNumberValueEv+0xb562
1d 00d9a828 006e3271     brewtarget+0x1c92ca
1e 00d9a868 00710caa     brewtarget+0x2e3271
1f 00d9a9b8 00712241     brewtarget+0x310caa
20 00d9a9e8 005c954e     brewtarget+0x312241
21 00d9aa38 006e9d5e     brewtarget+0x1c954e
22 00d9ab88 005bb9ba     brewtarget+0x2e9d5e
23 00d9abb8 005bb944     brewtarget+0x1bb9ba
24 00d9abe8 004c5927     brewtarget+0x1bb944
25 00d9ad38 0040a03a     brewtarget+0xc5927
26 00d9adc8 6fa5ec73     brewtarget+0xa03a
27 00d9ae68 6e7f42ee     Qt5Core!ZN9QMimeType18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv+0x85f3
28 00d9ae78 6e7f42ee     Qt5Widgets!ZN7QAction8activateENS_11ActionEventE+0xde
29 00d9aea8 6e973e30     Qt5Widgets!ZN7QAction8activateENS_11ActionEventE+0xde
2a 00d9aeb8 6e97bd6f     Qt5Widgets!ZN5QMenu7setIconERK5QIcon+0x260
2b 00d9aec8 6e97bd6f     Qt5Widgets!ZN5QMenu10enterEventEP6QEvent+0x9f
2c 00d9af08 6e97c04c     Qt5Widgets!ZN5QMenu10enterEventEP6QEvent+0x9f
2d 00d9af38 6e973a29     Qt5Widgets!ZN5QMenu10enterEventEP6QEvent+0x37c
2e 00000000 00000000     Qt5Widgets!ZN5QMenu11changeEventEP6QEvent+0x1a69
Melonbob commented 1 year ago

I finally got a tool-chain working on w10 and did a native build with MSYS2. I will start other threads with its problems (like permissions issues on make install), but the crashing is now comparable to v2.3.0 (intermittent whole record sets only). I will post with test results for all import/export and crash reports.

matty0ung commented 1 year ago

That's good news. FYI, I am, amongst other things, working to improve build system. (At the moment, you have to set up a lot of stuff by hand, but I have that largely automated with the overnight builds using the same automation. I haven't yet done a Brewtarget PR as I want to get packaging working in the new system - not least as I think it would make packaging problems easier to diagnose and fix!)

Melonbob commented 1 year ago

Here is the log from my MSYS2 MINGW32 package build with the current upstream. This is after initial startup and export of all the misc records.
brewtarget.log

Here are the logs after exporting all hop and yeast records. brewtarget.log brewtarget_2023_02_06_10_48_58_252.log

No Errors. No App crashes.

matty0ung commented 1 month ago

I'm going to close this, as it seems like you got things working in the end, and we did make the promised build system improvements along the way to BeerJSON. If you hit more problems, please don't hesitate to open another ticket.