CollapseLauncher / Collapse

An Advanced Launcher for miHoYo/HoYoverse Games
MIT License
1.41k stars 65 forks source link

[Bug]: Launcher crashing on verification phase during update #344

Closed farsdewibs0n closed 11 months ago

farsdewibs0n commented 11 months ago

Affected Version

1.72.11 Preview

Bug Behavior

Launcher crashes when updating Genshin Impact (after verification phase), the launcher becomes not responding and closes.

Expected Behavior

Launcher should apply the update

Steps to reproduce

  1. Download Genshin Impact Update
  2. Wait until verification
  3. After verification, the launcher becomes Not Responding and closes

Related Issues

No response

Screenshot(s)

No response

Additional Information

DxDiag.txt log-2023-12-21-pre1.72.11-id0.log

muscularcandy67 commented 11 months ago

Hello, did this happen with preload or not?

farsdewibs0n commented 11 months ago

Preload time has already passed, so im not sure since the update is already live

muscularcandy67 commented 11 months ago

What I meant is if you downloaded preload and then when update was live you hit update button or if you click update button without downloading preload when it was available

bagusnl commented 11 months ago

Since this is a hard crash, can you retrigger the crash again but before pressing update game, enable the console and see what's the crash message there. After that, also screenshot the error details from Event Manager.

Sorry it has to be quite extensive because both I and other maintainers are unable to reproduce the bug as of now

farsdewibs0n commented 11 months ago

image there are no crash message

Event manager result:

Faulting application name: CollapseLauncher.exe, version: 1.72.11.0, time stamp: 0x65410000 Faulting module name: ntdll.dll, version: 10.0.22621.2506, time stamp: 0xbced4b82 Exception code: 0xc0000374 Fault offset: 0x000000000010c7a9 Faulting process id: 0x0x28D0 Faulting application start time: 0x0x1DA33D59825FCF5 Faulting application path: D:\Program Files\Collapse Launcher\app-1.72.11\CollapseLauncher.exe Faulting module path: C:\Windows\SYSTEM32\ntdll.dll Report Id: d0dd8525-61a4-4683-abd6-26db5f49e2d6 Faulting package full name: Faulting package-relative application ID:

muscularcandy67 commented 11 months ago

As far as I remember that means something could be corrupted.

Can you run an sfc /scannow and dism /Online /Cleanup-Image /CheckHealth in an administrator prompt?

farsdewibs0n commented 11 months ago

What I meant is if you downloaded preload and then when update was live you hit update button or if you click update button without downloading preload when it was available

yes, I didnt finish downloading when its preload. Could be this is an issue?

bagusnl commented 11 months ago

could be something on your disk got corrupted

  1. Do this on command line chkdsk D: /F
  2. Download latest preview package

    https://github.com/CollapseLauncher/Collapse/releases/download/CL-v1.72.11-pre/CL-1.72.11-preview_Portable.7z Replace your entire D:\Program Files\Collapse Launcher\ with the contents from the package

  3. Try again

EDIT: To answer your question: No, Collapse should restart/continue the download just fine when the download were to incomplete

farsdewibs0n commented 11 months ago

Updating using normal launcher fixes the issue.

Edit: Where does the update file form Collapse launcher saved (since the normal launcher just redownloads the file again)

muscularcandy67 commented 11 months ago

Updating using normal launcher fixes the issue.

Did you though try to run any of the commands suggested by me and bagusnl or you just tried with official launcher?

Edit: Where does the update file form Collapse launcher saved (since the normal launcher just redownloads the file again)

The downloaded files should be exactly where official launcher downloads them. The most likely reason why it didn't detect the already downloaded files would be the file split into segments and not merged at the end (there is an option in Collapse to enable/disable the merge after download). Official launcher downloads the zip as a single file, meaning if something goes wrong in just a small part of the package the launcher would redownload everything, while having it segmented allows Collapse to redownload just the broken part, saving bandwidth though right now I don't remember if we actually redownload just the broken part or not but I'm sure the other maintainers will correct me if I'm wrong)

farsdewibs0n commented 11 months ago

Did you though try to run any of the commands suggested by me and bagusnl or you just tried with official launcher?

I just used the official launcher

bagusnl commented 11 months ago

Closing as can't reproduce

farsdewibs0n commented 11 months ago

Can I reopen this? It seems happened again after updating downloading HSR updates.

bagusnl commented 11 months ago

Have you done any of the suggestions we shared?

muscularcandy67 commented 11 months ago

Please run the following commands first in administrator prompt

sfc /scannow dism /Online /Cleanup-Image /CheckHealth chkdsk D: /F (Shouldn't be relevant but you can run this command on C: too)

farsdewibs0n commented 11 months ago

Results after chkdsk

C:\Users\Administrator>chkdsk D: /F The type of the file system is NTFS.

Chkdsk cannot run because the volume is in use by another process. Chkdsk may run if this volume is dismounted first. ALL OPENED HANDLES TO THIS VOLUME WOULD THEN BE INVALID. Would you like to force a dismount on this volume? (Y/N) y Volume dismounted. All opened handles to this volume are now invalid. Volume label is DATA.

Stage 1: Examining basic file system structure ... 1950464 file records processed. File verification completed. Phase duration (File record verification): 40.28 seconds. 4020 large file records processed. Phase duration (Orphan file record recovery): 2.18 milliseconds. 0 bad file records processed. Phase duration (Bad file record checking): 0.24 milliseconds.

Stage 2: Examining file name linkage ... 11356 reparse records processed. 2205506 index entries processed. Index verification completed. Phase duration (Index verification): 9.01 minutes. 0 unindexed files scanned. Phase duration (Orphan reconnection): 3.79 seconds. 0 unindexed files recovered to lost and found. Phase duration (Orphan recovery to lost and found): 8.16 milliseconds. 11356 reparse records processed. Phase duration (Reparse point and Object ID verification): 35.01 milliseconds.

Stage 3: Examining security descriptors ... CHKDSK is compacting the security descriptor stream Security descriptor verification completed. Phase duration (Security descriptor verification): 263.64 milliseconds. 127522 data files processed. Phase duration (Data attribute verification): 0.26 milliseconds. CHKDSK is verifying Usn Journal... 40012056 USN bytes processed. Usn Journal verification completed. Phase duration (USN journal verification): 1.14 seconds. Correcting errors in the Volume Bitmap.

Windows has made corrections to the file system. No further action is required.

1953382399 KB total disk space. 1899518908 KB in 1777216 files. 535856 KB in 127525 indexes. 0 KB in bad sectors. 2115987 KB in use by the system. 65536 KB occupied by the log file. 51211648 KB available on disk.

  4096 bytes in each allocation unit.

488345599 total allocation units on disk. 12802912 allocation units available on disk. Total duration: 9.77 minutes (586254 ms).

muscularcandy67 commented 11 months ago

What about the other commands?

farsdewibs0n commented 11 months ago

C:\Users\Administrator>sfc /scannow

Beginning system scan. This process will take some time.

Beginning verification phase of system scan. Verification 100% complete.

Windows Resource Protection found corrupt files but was unable to fix some of them. For online repairs, details are included in the CBS log file located at windir\Logs\CBS\CBS.log. For example C:\Windows\Logs\CBS\CBS.log. For offline repairs, details are included in the log file provided by the /OFFLOGFILE flag. [Uploading CBS.log…]()

farsdewibs0n commented 11 months ago

C:\Users\Administrator>dism /Online /Cleanup-Image /CheckHealth

Deployment Image Servicing and Management tool Version: 10.0.22621.2792

Image Version: 10.0.22631.2861

No component store corruption detected. The operation completed successfully.

muscularcandy67 commented 11 months ago

Try downloading through Collapse, if it fails try to find a way to fix stuff mentioned in sfc log before trying once again or plan to buy a new drive

farsdewibs0n commented 11 months ago

Try downloading through Collapse, if it fails try to find a way to fix stuff mentioned in sfc log before trying once again or plan to buy a new drive

Nothing on the log that's hinting on the collapse launcher files. So I dont think any issues with the Collapse launcher files gambar

muscularcandy67 commented 11 months ago

Did you retry running update through Collapse?

shatyuka commented 11 months ago

Based on the information provided by the Event Manager: Address: ntdll.dll+0x10c7a9 (RtlReportFatalFailure) Error Code: 0xc0000374 (STATUS_HEAP_CORRUPTION) Possibly a double free caused by Marshal.

Can you upload a crash dump?

farsdewibs0n commented 11 months ago

Can you upload a crash dump?

Where can I find the dump?

shatyuka commented 11 months ago

try procdump -ma -i YOUR_DUMP_FOLDER Download link here: https://download.sysinternals.com/files/Procdump.zip

farsdewibs0n commented 11 months ago

try procdump -ma -i YOUR_DUMP_FOLDER Where is the dump folder located?

Edit: Is it "C:\Users\\AppData\Local\CrashDumps"

farsdewibs0n commented 11 months ago

Dump file: https://drive.google.com/file/d/1jo8yKs0VhRQdkD93SssxJoPKWWriEwKk/view?usp=sharing

Had to use Google drive because the dump size is 500MB

shatyuka commented 11 months ago

Thanks for the dump.

Exception details:

Heap address:  000002b25c2a0000
Error address: 000002b214e844d0
Error type: HEAP_FAILURE_BLOCK_NOT_BUSY
Details:    The caller performed an operation (such as a free
            or a size check) that is illegal on a free block.
Follow-up:  Check the error's stack trace to find the culprit.

FAILURE_BUCKET_ID:  HEAP_CORRUPTION_ACTIONABLE_BlockNotBusy_DOUBLE_FREE_c0000374_ntdll.dll!RtlpFreeHeapInternal

CLR stack:

000000B62017C8F0 00007ffdc8bbaa90 SevenZipExtractor.PropVariant.Clear() [D:\a\Collapse\Collapse\Hi3Helper.Core\Classes\Data\Tools\SevenZipTool\SevenZipExtractor\SevenZipExtractor\SevenZipInterface.cs @ 161]
000000B62017C9C0 00007ffdc8bbb372 SevenZipExtractor.ArchiveFile.GetProperty[[System.__Canon, System.Private.CoreLib]](UInt32, SevenZipExtractor.ItemPropId)
000000B62017CA30 00007ffdc8bb8218 SevenZipExtractor.ArchiveFile.get_Entries() [D:\a\Collapse\Collapse\Hi3Helper.Core\Classes\Data\Tools\SevenZipTool\SevenZipExtractor\SevenZipExtractor\ArchiveFile.cs @ 185]
000000B62017CB50 00007ffdc8bb7c70 SevenZipExtractor.ArchiveFile..ctor(System.IO.Stream, System.Nullable`1<SevenZipExtractor.SevenZipFormat>, System.String) [D:\a\Collapse\Collapse\Hi3Helper.Core\Classes\Data\Tools\SevenZipTool\SevenZipExtractor\SevenZipExtractor\ArchiveFile.cs @ 69]
...

PropVariantClear causes a double free. https://github.com/CollapseLauncher/SevenZipExtractor/blob/2daea137ebdd5ae4183e146a3c32b4d82bd6a625/SevenZipExtractor/SevenZipInterface.cs#L161

bagusnl commented 11 months ago

PropVariantClear causes a double free.

CC @neon-nyan

neon-nyan commented 11 months ago

Thank you for the heads up @shatyuka @bagusnl

Seems to be an issue where the zip file have non-generic types of property and then tried to marshal those data into PropVariant struct. Will look into the double free issue too and give you guys an update for this

muscularcandy67 commented 11 months ago

I still have to update my HSR. Want me to do it in debug mode and see if I catch something?

bagusnl commented 11 months ago

I have done entire patching on HSR with ReSharper's DPA and it didn't catch any issue. But sure, you can try

neon-nyan commented 11 months ago

I still have to update my HSR. Want me to do it in debug mode and see if I catch something?

Sure, you can try set breakpoints in the SevenZipExtractor > SevenZipInterface.cs @Line 116 and Line 161 I should expect that there's no exception getting catch if a crash happen due to an error throws in CoreCLR level. But you can try if that catch the exception or not.

muscularcandy67 commented 11 months ago

That's what I did but no exception was thrown and it now switched to extracting phase, so I couldn't replicate the crash

muscularcandy67 commented 11 months ago

Just to be sure @farsdewibs0n , the Windows you're running it's not one of those modified versions that debloats as much as they can to reduce size and resources usage?

neon-nyan commented 11 months ago

@farsdewibs0n Can you please try this Nightly Build? Let's see if it fixes your issue.

farsdewibs0n commented 11 months ago

Just to be sure @farsdewibs0n , the Windows you're running it's not one of those modified versions that debloats as much as they can to reduce size and resources usage?

Uhh no. Are there issues that causes by it?

Edit: Nvm, it is. I asked a friend to help me reinstall it turns out its modified Windows 11 (Ghost Spectre)

farsdewibs0n commented 11 months ago

@farsdewibs0n Can you please try this Nightly Build? Let's see if it fixes your issue.

Still doesn't work

neon-nyan commented 11 months ago

@farsdewibs0n Can you please try this Nightly Build? Let's see if it fixes your issue.

Still doesn't work

Can you please send us the crash dump file again?

muscularcandy67 commented 11 months ago

Just to be sure @farsdewibs0n , the Windows you're running it's not one of those modified versions that debloats as much as they can to reduce size and resources usage?

Uhh no. Are there issues that causes by it?

Edit: Nvm, it is. I asked a friend to help me reinstall it turns out its modified Windows 11 (Ghost Spectre)

With some stuff modified Windows editions can give some unexpected problems. I remember for another project (not mine) one specific user on a heavily stripped down version of Windows was unable to use the program with very random behaviors no one could replicate.

muscularcandy67 commented 11 months ago

Just to make sure, these are the first time you're updating through Collapse or not? Just wondering if other times it succeeded or not

farsdewibs0n commented 11 months ago

@farsdewibs0n Can you please try this Nightly Build? Let's see if it fixes your issue.

Still doesn't work

Can you please send us the crash dump file again?

Here: https://drive.google.com/file/d/1ijh2jYsb2Kae4HpPoX9WBH30kY86-Ay_/view?usp=sharing

farsdewibs0n commented 11 months ago

Just to make sure, these are the first time you're updating through Collapse or not? Just wondering if other times it succeeded or not

Yes, this is my first time

farsdewibs0n commented 11 months ago

Wondering how different Collapse implementing on applying updates than default launcher. Any reason why? So far I know the update file from Collapse is split on 2 files (unlike the normal one is basically one file).

muscularcandy67 commented 11 months ago

It looks like it crashed pretty much at the same point? Could it actually have something to do with their Windows? When opening the dmp file to analyze it I got this warning

*** WARNING: Check Image - Checksum mismatch - Dump: 0x21ded8, File: 0x222eb8 - C:\ProgramData\Dbg\sym\ntdll.dll\BCED4B82217000\ntdll.dll`

CLR Stack

0000008D1877C970 00007ffe89befec4 [InlinedCallFrame: 0000008d1877c970] SevenZipExtractor.PropVariant.PropVariantClearInvoke(IntPtr)
0000008D1877C970 00007ffdd13c5bf0 [InlinedCallFrame: 0000008d1877c970] SevenZipExtractor.PropVariant.PropVariantClearInvoke(IntPtr)
0000008D1877C940 00007ffdd13c5bf0 ILStubClass.IL_STUB_PInvoke(IntPtr)
0000008D1877CA00 00007ffe6ef0ae90 SevenZipExtractor.PropVariant.GetObjectAndClear()
...
muscularcandy67 commented 11 months ago

Wondering how different Collapse implementing on applying updates than default launcher. Any reason why? So far I know the update file from Collapse is split on 2 files (unlike the normal one is basically one file).

Did you try a fresh game install with Collapse yet? If not can you try? (You can just download another HSR region, so it won't take up too much space)

farsdewibs0n commented 11 months ago

Wondering how different Collapse implementing on applying updates than default launcher. Any reason why? So far I know the update file from Collapse is split on 2 files (unlike the normal one is basically one file).

Did you try a fresh game install with Collapse yet? If not can you try? (You can just download another HSR region, so it won't take up too much space)

like switching region? Or Download everything?

bagusnl commented 11 months ago

Wondering how different Collapse implementing on applying updates than default launcher. Any reason why? So far I know the update file from Collapse is split on 2 files (unlike the normal one is basically one file).

To answer your question, those are fragmented files from the download, if you merge them its the same file as the one that official launcher downloaded. This is to accelerate download speed by using more threads when downloading, same way as some download managers like IDM, aria2, etc does.

You can ask Collapse to merge those files post download in the settings called "Merge Downloaded Package Chunks" image (github image currently broken)

neon-nyan commented 11 months ago

Thank you again for sending us the dump file! @farsdewibs0n

It looks like it crashed pretty much at the same point? Could it actually have something to do with their Windows? When opening the dmp file to analyze it I got this warning

*** WARNING: Check Image - Checksum mismatch - Dump: 0x21ded8, File: 0x222eb8 - C:\ProgramData\Dbg\sym\ntdll.dll\BCED4B82217000\ntdll.dll`

CLR Stack

0000008D1877C970 00007ffe89befec4 [InlinedCallFrame: 0000008d1877c970] SevenZipExtractor.PropVariant.PropVariantClearInvoke(IntPtr)
0000008D1877C970 00007ffdd13c5bf0 [InlinedCallFrame: 0000008d1877c970] SevenZipExtractor.PropVariant.PropVariantClearInvoke(IntPtr)
0000008D1877C940 00007ffdd13c5bf0 ILStubClass.IL_STUB_PInvoke(IntPtr)
0000008D1877CA00 00007ffe6ef0ae90 SevenZipExtractor.PropVariant.GetObjectAndClear()
...

@muscularcandy67 This is what I thought that there might be something wrong in their ole32.dll library (which actually contains PropVariantClear(PROPVARIANT* pvar) function) or there might be other things going on.

As per your call stack, I could confirm that the issue is indeed at the time PropVariant struct being freed by PropVariantClearInvoke(nint ptr) -> PropVariantClear(PROPVARIANT* pvar) while getting attached to GCHandle as a GCHandleType.Pinned

image

Since you're using the Ghost Spectre edition of Windows (which I'm afraid that there might be specific issue with it), can you tell me @farsdewibs0n:

  1. Which build of Ghost Spectre edition of Windows you're on right now?

    If you have the link to download the installation specifically for that build, that would be great.

  2. Any chance that you're using a third-party antivirus product?

We apologize for the trouble caused since this issue is complicated and we could not replicate at our end.

Also @shatyuka, do you have any idea about this? just to make sure if something is missing in the way of the code freeing or allocating the struct.

shatyuka commented 11 months ago

Will look at it later.