BytexDigital / BytexDigital.Steam

Wrapper library of SteamKit2 for simpler usage of specific APIs such as downloading apps and workshop content from Steam
Other
12 stars 3 forks source link

Downloader Cannot Open File #11

Closed Foxlider closed 2 years ago

Foxlider commented 2 years ago

I am having a few issues with files sometimes. It seems the downloader tries to access files that are already opened or access them twice (but I might be wrong).

   at BytexDigital.Steam.ContentDelivery.Models.Downloading.MultipleFilesHandler.<>c.<DownloadAsync>b__45_3(Func`1 factory, Task task)
   at BytexDigital.Steam.ContentDelivery.Models.Downloading.MultipleFilesHandler.<ParallelAsync>d__47.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at BytexDigital.Steam.ContentDelivery.Models.Downloading.MultipleFilesHandler.<DownloadAsync>d__45.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at BytexDigital.Steam.ContentDelivery.Models.Downloading.MultipleFilesHandler.<DownloadAsync>d__45.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at BytexDigital.Steam.ContentDelivery.Models.Downloading.MultipleFilesHandler.<DownloadToFolderAsync>d__44.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at BytexDigital.Steam.ContentDelivery.Models.Downloading.MultipleFilesHandler.<DownloadToFolderAsync>d__43.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at FASTER.ViewModel.SteamUpdaterViewModel.<Download>d__65.MoveNext() in E:\Code\GitHub\FASTER\FASTER\ViewModel\SteamUpdaterViewModel.cs:line 494
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at FASTER.ViewModel.SteamUpdaterViewModel.<RunModUpdater>d__61.MoveNext() in E:\Code\GitHub\FASTER\FASTER\ViewModel\SteamUpdaterViewModel.cs:line 266

The odd thing is that the file doesn't appear to be opened at all. When using handle.exe from SysInternalsSuite the file is not flagged as opened

RyanTT commented 2 years ago

What's the exception type being thrown? And is this the entire stacktrace?

Foxlider commented 2 years ago

The main exception is an Aggregate Exception

It has an InnerException though The exception is a System.IO.IOEception

   at System.IO.FileSystem.DeleteFile(String fullPath)
   at System.IO.File.Delete(String path)
   at BytexDigital.Steam.ContentDelivery.Models.Downloading.MultipleFilesHandler.VerifyFileAsync(ManifestFile file, String directory, ConcurrentBag`1 chunks) in C:\Users\Keelah\AppData\Local\JetBrains\Shared\vAny\DecompilerCache\decompiler\590298A9-FE4F-4AFC-A16B-7153B1CB099D\ec\507b6572\MultipleFilesHandler.cs:line 228
   at BytexDigital.Steam.ContentDelivery.Models.Downloading.MultipleFilesHandler.<>c__DisplayClass45_2.<DownloadAsync>b__12() in C:\Users\Keelah\AppData\Local\JetBrains\Shared\vAny\DecompilerCache\decompiler\590298A9-FE4F-4AFC-A16B-7153B1CB099D\ec\507b6572\MultipleFilesHandler.cs:line 112
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   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 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at BytexDigital.Steam.ContentDelivery.Models.Downloading.MultipleFilesHandler.<>c__DisplayClass45_2.<<DownloadAsync>b__11>d.MoveNext() in C:\Users\Keelah\AppData\Local\JetBrains\Shared\vAny\DecompilerCache\decompiler\590298A9-FE4F-4AFC-A16B-7153B1CB099D\ec\507b6572\MultipleFilesHandler.cs:line 112
RyanTT commented 2 years ago

Whats the message of the IOException? Access denied?

Foxlider commented 2 years ago

Sorry I forgot to include the message again

Error: One or more errors occurred. (The process cannot access the file 'E:\16aa_PUBLIC_USER\!Server_Files_1.8\arma3server.exe' because it is being used by another process.) Inner Exception: The process cannot access the file 'E:\16aa_PUBLIC_USER\!Server_Files_1.8\arma3server.exe' because it is being used by another process

It happened to an user who downloaded files from a depot, switched depot branch, updated and switched back to main branch before updating again and got the error.

I keep haing the error while downloading the ace arma3 mod. Seems pretty random

RyanTT commented 2 years ago

I couldn't really determine what might be the root cause of this. As it appears to be failing during the verification already (and since verification does not have a lot of complexity to it), please check that the file is actually not protected at the time of trying to update it. Simplest way would be to have this library error out with this exception, and then without closing anything, just trying to delete the files in question manually via explorer to determine if there truly is no open handle on it. Right now I don't have any idea what this might be I'm afraid

Foxlider commented 2 years ago

That's my point. No file handle seem to be locked and I could delete the folder without issues.

On Fri, 10 Dec 2021, 03:06 Ryan, @.***> wrote:

I couldn't really determine what might be the root cause of this. As it appears to be failing during the verification already (and since verification does not have a lot of complexity to it), please check that the file is actually not protected at the time of trying to update it. Simplest way would be to have this library error out with this exception, and then without closing anything, just trying to delete the files in question manually via explorer to determine if there truly is no open handle on it. Right now I don't have any idea what this might be I'm afraid

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BytexDigital/BytexDigital.Steam/issues/11#issuecomment-990533619, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEW3PSYUYRSUUGPU2ZVZOGDUQFOCPANCNFSM5JTF5ZEQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

RyanTT commented 2 years ago

Hm. Does this happen on first attempt to update after opening the program, or perhaps only after the second attempt (after the updater has already checked/touched these files once)?

Foxlider commented 2 years ago

It keep happening all the time but usually it's always the same file.

On Fri, 10 Dec 2021, 16:03 Ryan, @.***> wrote:

Hm. Does this happen on first attempt to update after opening the program, or perhaps only after the second attempt (after the updater has already checked/touched these files once)?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BytexDigital/BytexDigital.Steam/issues/11#issuecomment-991045327, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEW3PS72YOLOANACEK2RBT3UQIJDHANCNFSM5JTF5ZEQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

RyanTT commented 2 years ago

Appears to have been user error (?)