CollapseLauncher / Collapse

An Advanced Launcher for miHoYo/HoYoverse Games
MIT License
1.37k stars 63 forks source link

A bug when continuing installation #53

Closed tilsgee closed 1 year ago

tilsgee commented 1 year ago

when i install Honkai (maybe also applied to Genshin), and stop it at certain percent, and install it again (both resume and start from beginning), this happened:

Installation cancelled for game Honkai Impact 3rd (Global - North America - Europe) because of IO Error! System.IO.IOException: The process cannot access the file 'C:\Tils-Gee\Mihoyo\Gamedata\BH3_v6.1.0_62c4d9d7ab65.7z.277680' because it is being used by another process. at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) at Hi3Helper.Http.Session..ctor(String PathURL, String PathOutput, Stream SOutput, CancellationToken SToken, Boolean IsFileMode, Nullable1 OffsetStart, Nullable`1 OffsetEnd, Boolean Overwrite) in F:\myGit\CollapseLauncher\Hi3Helper.Http\Class\Session\Session.cs:line 38 at Hi3Helper.Http.Http.InitializeMultiSession() in F:\myGit\CollapseLauncher\Hi3Helper.Http\Class\Session\SessionManager.cs:line 106 at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at Hi3Helper.Http.Http.Download(String URL, String Output, Byte ConnectionSessions, Boolean Overwrite, CancellationToken ThreadToken) in F:\myGit\CollapseLauncher\Hi3Helper.Http\HttpMulti.cs:line 50 at CollapseLauncher.InstallManagement.StartDownloadAsync() in F:\myGit\CollapseLauncher\CollapseLauncher\Classes\InstallManagement\InstallManagement.cs:line 186 at CollapseLauncher.Pages.HomePage.DownloadGameClient(String destinationFolder) in F:\myGit\CollapseLauncher\CollapseLauncher\XAMLs\MainApp\Pages\HomePage.xaml.cs:line 831 at CollapseLauncher.Pages.HomePage.StartInstallationProcedure(String destinationFolder) in F:\myGit\CollapseLauncher\CollapseLauncher\XAMLs\MainApp\Pages\HomePage.xaml.cs:line 702 at CollapseLauncher.Pages.HomePage.InstallGameDialog(Object sender, RoutedEventArgs e) in F:\myGit\CollapseLauncher\CollapseLauncher\XAMLs\MainApp\Pages\HomePage.xaml.cs:line 675

bagusnl commented 1 year ago

Noticed this bug too when updating cache/downloading repair files that sometime the thread stuck and didn't properly release the file upon pressing pause/cancel. The current workaround for me is to just close the app and restart download again. Already talked to author about this but probably it got swept by as we were talking about other stuff as well xd

neon-nyan commented 1 year ago

I could confirm that this issue caused by the Session not getting disposed properly on Hi3Helper.Http submodule. I'm trying to address this issue for now.

neon-nyan commented 1 year ago

This issue has been addressed in the latest commit: f3300b7. The fix will be coming to the next preview release.

I'm not going to close this issue until the next stable release or maybe the next minor update for stable release.

neon-nyan commented 1 year ago

Closing this issue for now as the fix has already been implemented in current preview release and also be shipped in the next stable release