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

Crash (stack overflow in Qt) on some Windows builds during "check for new version" #866

Closed
matty0ung opened this issue Oct 27, 2024 · 13 comments

Comments

@matty0ung
Copy link
Contributor

After DB upgrade but during data load, application crashes with the following in Windows Event Viewer:

- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name="Application Error" /> 
  <EventID Qualifiers="0">1000</EventID> 
  <Version>0</Version> 
  <Level>2</Level> 
  <Task>100</Task> 
  <Opcode>0</Opcode> 
  <Keywords>0x80000000000000</Keywords> 
  <TimeCreated SystemTime="2024-10-27T01:48:19.7807552Z" /> 
  <EventRecordID>4224</EventRecordID> 
  <Correlation /> 
  <Execution ProcessID="0" ThreadID="0" /> 
  <Channel>Application</Channel> 
  <Computer>Matt-Virt-Win</Computer> 
  <Security /> 
  </System>
- <EventData>
  <Data>brewtarget.exe</Data> 
  <Data>0.0.0.0</Data> 
  <Data>671d1b01</Data> 
  <Data>libicuuc75.dll</Data> 
  <Data>0.0.0.0</Data> 
  <Data>6673f081</Data> 
  <Data>c00000fd</Data> 
  <Data>000000000005e8a7</Data> 
  <Data>2650</Data> 
  <Data>01db281243497f95</Data> 
  <Data>C:\Program Files\Brewtarget-4.0.8\bin\brewtarget.exe</Data> 
  <Data>C:\Program Files\Brewtarget-4.0.8\bin\libicuuc75.dll</Data> 
  <Data>d604a74d-2483-4691-84ac-9bcae65c8d4d</Data> 
  <Data /> 
  <Data /> 
  </EventData>
  </Event>

Log file ends after reading from the salt DB table:

[02:48:04.364] (7j0) INFO : Starting Brewtarget v 4.0.8  (app name "brewtarget" ) on  "Windows 10 Version 22H2"  [main.cpp:231]
[02:48:04.364] (7j0) INFO : Built at Sat, Oct 26, 2024  4:16:47 PM on windows for windows with gcc compiler  [main.cpp:234]
[02:48:04.364] (7j0) INFO : Log directory: "C:/Users/Matt/AppData/Local/brewtarget"  [main.cpp:237]
[02:48:04.364] (7j0) INFO : Using Qt runtime v 6.8.0  (compiled against Qt v 6.8.0 )  [main.cpp:238]
[02:48:04.364] (7j0) INFO : Configuration directory: "C:/Users/Matt/AppData/Local/brewtarget"  [main.cpp:239]
[02:48:04.364] (7j0) INFO : Data directory: "C:/Users/Matt/AppData/Local/brewtarget"  [main.cpp:240]
[02:48:04.364] (7j0) INFO : void {anonymous}::initResourceDir(QDir&) Application name "brewtarget"  [Application.cpp:361]
[02:48:04.364] (7j0) INFO : void {anonymous}::initResourceDir(QDir&) Determined resource directory is "C:/Program Files/Brewtarget-4.0.8/data"  [Application.cpp:392]
[02:48:04.364] (7j0) INFO : Resource directory: "C:/Program Files/Brewtarget-4.0.8/data"  [main.cpp:241]
[02:48:05.474] (7j0) INFO : bool {anonymous}::ensureDirectoriesExist() Resource directory "C:/Program Files/Brewtarget-4.0.8/data" exists  [Application.cpp:150]
[02:48:05.490] (7j0) WARNING : void Localization::loadTranslations() Error loading translations for "fr_FR"  [Localization.cpp:228]
[02:48:05.490] (7j0) INFO : Locale: "fr_FR" (Decimal point: "," / Thousands separator: " " )  [Application.cpp:435]
[02:48:05.490] (7j0) INFO : bool Application::initialize() Loading Database...  [Application.cpp:452]
[02:48:05.490] (7j0) INFO : bool Database::load() Known DB drivers:  QList("QIBASE", "QSQLITE", "QMARIADB", "QMYSQL", "QODBC", "QPSQL")  [database/Database.cpp:716]
[02:48:05.490] (7j0) INFO : bool Database::impl::loadSQLite(Database&) dbFileName = " C:/Users/Matt/AppData/Local/brewtarget/database.sqlite "
dataDbFileName=" C:/Program Files/Brewtarget-4.0.8/bin/../data/default_db.sqlite "  [database/Database.cpp:254]
[02:48:05.490] (7j0) INFO : bool Database::impl::loadSQLite(Database&) SQLite version QVariant(QString, "3.46.1")  [database/Database.cpp:303]
[02:48:05.505] (7j0) INFO : bool Database::impl::updateSchema(Database&, bool*) Schema version in DB: 10 , current schema version in code: 14  [database/Database.cpp:400]
[02:48:14.472] (7j0) INFO : DefaultContentLoader::UpdateResult DefaultContentLoader::updateContentIfNecessary(QSqlDatabase&, QTextStream&) availableContentVersion: 4 , defaultContentAlreadyLoaded: 0  [database/DefaultContentLoader.cpp:97]
[02:48:17.238] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 29 objects from DB table recipe  [database/ObjectStore.cpp:1682]
[02:48:17.241] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 0 objects from DB table brewnote  [database/ObjectStore.cpp:1682]
[02:48:17.268] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 127 objects from DB table style  [database/ObjectStore.cpp:1682]
[02:48:17.273] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 33 objects from DB table equipment  [database/ObjectStore.cpp:1682]
[02:48:17.295] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 375 objects from DB table fermentable  [database/ObjectStore.cpp:1682]
[02:48:17.303] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 127 objects from DB table hop  [database/ObjectStore.cpp:1682]
[02:48:17.306] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 91 objects from DB table misc  [database/ObjectStore.cpp:1682]
[02:48:17.313] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 164 objects from DB table yeast  [database/ObjectStore.cpp:1682]
[02:48:17.316] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 14 objects from DB table water  [database/ObjectStore.cpp:1682]
[02:48:18.652] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 29 objects from DB table boil  [database/ObjectStore.cpp:1682]
[02:48:18.654] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 73 objects from DB table boil_step  [database/ObjectStore.cpp:1682]
[02:48:18.655] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 29 objects from DB table fermentation  [database/ObjectStore.cpp:1682]
[02:48:18.656] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 32 objects from DB table fermentation_step  [database/ObjectStore.cpp:1682]
[02:48:18.657] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 0 objects from DB table instruction  [database/ObjectStore.cpp:1682]
[02:48:18.659] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 375 objects from DB table fermentable_in_inventory  [database/ObjectStore.cpp:1682]
[02:48:18.661] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 127 objects from DB table hop_in_inventory  [database/ObjectStore.cpp:1682]
[02:48:18.662] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 91 objects from DB table misc_in_inventory  [database/ObjectStore.cpp:1682]
[02:48:18.663] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 0 objects from DB table salt_in_inventory  [database/ObjectStore.cpp:1682]
[02:48:18.665] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 164 objects from DB table yeast_in_inventory  [database/ObjectStore.cpp:1682]
[02:48:18.666] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 30 objects from DB table mash  [database/ObjectStore.cpp:1682]
[02:48:18.668] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 35 objects from DB table mash_step  [database/ObjectStore.cpp:1682]
[02:48:18.671] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 121 objects from DB table fermentable_in_recipe  [database/ObjectStore.cpp:1682]
[02:48:18.672] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 64 objects from DB table hop_in_recipe  [database/ObjectStore.cpp:1682]
[02:48:18.672] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 0 objects from DB table misc_in_recipe  [database/ObjectStore.cpp:1682]
[02:48:18.674] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 29 objects from DB table yeast_in_recipe  [database/ObjectStore.cpp:1682]
[02:48:18.674] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 0 objects from DB table salt_in_recipe  [database/ObjectStore.cpp:1682]
[02:48:18.675] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 0 objects from DB table water_in_recipe  [database/ObjectStore.cpp:1682]
[02:48:18.675] (7j0) INFO : void ObjectStore::loadAll(Database*) Read 0 objects from DB table salt  [database/ObjectStore.cpp:1682]
@matty0ung
Copy link
Contributor Author

Running inside gdb shows initiateCheckForNewVersion calling into Qt and then something inside Qt seems to get stuck in some recursion loop. Bottom few lines of the stack trace are:

#9720 0x00007ff99a66b187 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#9721 0x00007ff99a585903 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#9722 0x00007ff99a585b23 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#9723 0x00007ff99a5867ab in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#9724 0x00007ff99a58cade in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#9725 0x00007ff99a58d915 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#9726 0x00007ff99a675ab5 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#9727 0x00007ff99a676cd8 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#9728 0x00007ff99a6811ac in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#9729 0x00007ff99a5929ce in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#9730 0x00007ff99a592add in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#9731 0x00007ff9952f2b88 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\tls\qschannelbackend.dll
#9732 0x00007ff9952ecd91 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\tls\qschannelbackend.dll
#9733 0x00007ff9952edcc1 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\tls\qschannelbackend.dll
#9734 0x00007ff99b31f2c2 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Network.dll
#9735 0x00007ff995301f4b in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\tls\qschannelbackend.dll
#9736 0x00007ff9952fc15c in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\tls\qschannelbackend.dll
#9737 0x00007ff9952fc391 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\tls\qschannelbackend.dll
#9738 0x00007ff99b3b4657 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Network.dll
#9739 0x00007ff99b3a8354 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Network.dll
#9740 0x00007ff99b2ea687 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Network.dll
#9741 0x00007ff99b3789df in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Network.dll
#9742 0x00007ff99b2cfdd3 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Network.dll
#9743 0x00007ff99b2d0b0e in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Network.dll
#9744 0x000000014002cda2 in (anonymous namespace)::initiateCheckForNewVersion (mw=0x2895f50) at ../src/Application.cpp:308
#9745 Application::run () at ../src/Application.cpp:492
#9746 0x000000014061e7ae in main (argc=<optimized out>, argv=<optimized out>) at ../src/main.cpp:247

@matty0ung
Copy link
Contributor Author

matty0ung commented Oct 27, 2024

Top of the stack trace is:

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ff9e1aeec7a in ntdll!RtlGetFullPathName_UstrEx () from C:\WINDOWS\SYSTEM32\ntdll.dll
(gdb) bt
#0  0x00007ff9e1aeec7a in ntdll!RtlGetFullPathName_UstrEx () from C:\WINDOWS\SYSTEM32\ntdll.dll
#1  0x00007ff9e1aee2a9 in ntdll!RtlGetFullPathName_UstrEx () from C:\WINDOWS\SYSTEM32\ntdll.dll
#2  0x00007ff9e1afe666 in ntdll!RtlAllocateHeap () from C:\WINDOWS\SYSTEM32\ntdll.dll
#3  0x00007ff9e1afb44d in ntdll!RtlAllocateHeap () from C:\WINDOWS\SYSTEM32\ntdll.dll
#4  0x00007ff9e1bc8958 in ntdll!RtlRegisterSecureMemoryCacheCallback () from C:\WINDOWS\SYSTEM32\ntdll.dll
#5  0x00007ff9e1afd255 in ntdll!RtlAllocateHeap () from C:\WINDOWS\SYSTEM32\ntdll.dll
#6  0x00007ff9e1afb44d in ntdll!RtlAllocateHeap () from C:\WINDOWS\SYSTEM32\ntdll.dll
#7  0x00007ff9e05e9d40 in msvcrt!malloc () from C:\WINDOWS\System32\msvcrt.dll
#8  0x00007ff998507f09 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\libicuuc75.dll
#9  0x00007ff9987a09f0 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\libicuin75.dll
#10 0x00007ff9987a0a76 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\libicuin75.dll
#11 0x00007ff9987a0fa1 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\libicuin75.dll
#12 0x00007ff99876cd6a in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\libicuin75.dll
#13 0x00007ff99876d29d in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\libicuin75.dll
#14 0x00007ff998723354 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\libicuin75.dll
#15 0x00007ff998723b9d in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\libicuin75.dll
#16 0x00007ff9987a2edb in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\libicuin75.dll
#17 0x00007ff99a672c42 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#18 0x00007ff99a66c9c9 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#19 0x00007ff99a66895f in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#20 0x00007ff99a672da8 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#21 0x00007ff99a66c9c9 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#22 0x00007ff99a66895f in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#23 0x00007ff99a672da8 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#24 0x00007ff99a66c9c9 in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll
#25 0x00007ff99a66895f in ?? () from C:\Program Files\Brewtarget-4.0.8\bin\Qt6Core.dll

The bit in the middle (~9700 lines not pasted here) is rather repetitive!

@matty0ung
Copy link
Contributor Author

Interestingly, this problem doesn't occur if I build and install locally (on a Windows 10 VM running on Linux host). It also doesn't occur if I build the package and install from that. So something is different about the GitHub Action build.

@matty0ung matty0ung changed the title Start-up crash on Windows Crash (stack overflow in Qt) on some Windows builds during "check for new version" Oct 28, 2024
@matty0ung
Copy link
Contributor Author

We know the crash occurs in QNetworkAccessManager::get() but not why, and it's a bit hard to add diagnostics. I'm going to try a workaround of using Boost instead of Qt to do the HTTP request to GitHub that checks for a new version of the program. It's a bit of a sledgehammer to crack a nut, but it could be the quickest way of getting the issue resolved.

@matty0ung
Copy link
Contributor Author

I have a rough version of the fix coded in #867, and the GitHub Actions build runs fine on my local Windows instance. I need to do a bit of tidy up in the code, but I hope to have something working within the next week.

@karthil
Copy link

karthil commented Nov 2, 2024

I have a rough version of the fix coded in #867, and the GitHub Actions build runs fine on my local Windows instance. I need to do a bit of tidy up in the code, but I hope to have something working within the next week.

I just tried installing multiple releases including 4.08 and 4.05 on Windows 11, build 22631.4391. I have a crash when I try to start the program; haven't gotten it to run. I was prompted to add new ingredients. If I say yes, I see this:
image
If I say no, it closes the command prompt quickly enough that I can't catch the assert, assuming there is one.

Does this sound like the same issue?

Thanks!

@matty0ung
Copy link
Contributor Author

Hmm, that looks like #868.

@karthil
Copy link

karthil commented Nov 2, 2024

Unless I misread, the submitter mentioned a crash when performing a specific step. The program won't even start for me, not even once. Perhaps somehow the same cause but it's happening to me in a different context?

@matty0ung
Copy link
Contributor Author

Ah, OK, sorry I misunderstood. I had misread your comment and thought it was only crashing when you tried to import new ingredients. Would you be able to upload the log file? It should be in a directory similar to C:\Users\Matt\AppData\Local\brewtarget (but with "Matt" replaced by your Windows user name").

@karthil
Copy link

karthil commented Nov 2, 2024

Sure; hopefully this is it. It does seem to contain error messages and was updated when I tried to start the program.
brewtarget.log

@matty0ung
Copy link
Contributor Author

matty0ung commented Nov 2, 2024

Thanks for that - it helped. I think I've managed to reproduce at least part of the problem you're seeing. It should be addressed by the fix I'm currently working on. Hope to have something within the upcoming week.

@karthil
Copy link

karthil commented Nov 2, 2024 via email

@matty0ung
Copy link
Contributor Author

Should be fixed in release 4.0.9. Please don't hesitate to open another ticket if you hit other problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants