CKAN complains about temp files when upgrading a mod and installing another one at the same time

Created on 10 Aug 2015  Â·  43Comments  Â·  Source: KSP-CKAN/CKAN

When I download a large amount of mods, CKAN barfs, complaining that it can't access this ONE temp file.

Unhandled exception:
System.IO.IOException: The process cannot access the file 'C:\Users\FireFaced\AppData\Local\Temp\tmp8C0B.tmp' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at CKAN.NetAsyncDownloader.ModuleDownloadsComplete(Ne tFileCache cache, Uri[] urls, String[] filenames, Exception[] errors)
at CKAN.NetAsyncDownloader.c__AnonSt orey2.<>m__1(Uri[] _uris, String[] paths, Exception[] errors)
at System.Threading.ExecutionContext.RunInternal(Exec utionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System. Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()

Bug Core (ckan.dll) ★★☆

All 43 comments

May be related to #801

I don't think so. @Postremus

Okay, I cleared my temp file, issue doesn't seem to come up. Closing this, and it seems that it is related to #801

All right, I'm sick of this. Now it's holding onto a different temp file EVEN THOUGH my temp folder is merely 1MB

_facepalm_ Remind me NOT to click the close button

Ugh. @pjf can you please reopen this? I didn't mean to click "comment and close"

Thank you, I didn't mean to close it after I reopened it.

I am able to reliably reproduce temp file issues by trying to both upgrade a mod and install a new one at the same time. Not sure if it's related.

Yeah, usually when I install mods, I also just run through the upgrades. Strange

Anyone?

Can you Point the issue down to a specific mod?

No, it's pretty broad. It usually comes up when I install a lot of mods AND upgrade a bunch of mods at the same time.

I've had it occur with as little as a single new mod install and a single mod update in the same change list.

Huh. Yeah, the issue is quite broad.

@FireFaced @squizzeak I am unable to reproduce this bug. Would you mind testing a dev version which may fix this issue?

Sure

I gave this issue a higher priority, since it is a bad thing if ckan doesn't do it's job (installing mods).

Same result with the version you posted, attempting to update 3 mods and install 1 new one.

Unhandled exception:
System.IO.IOException: The process cannot access the file because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalMove(String sourceFileName, String destFileName, Boolean checkHost)
at ChinhDo.Transactions.TxFileManager.Move(String srcFileName, String destFileName)
at CKAN.NetFileCache.Store(Uri url, String path, String description, Boolean move)
at CKAN.NetAsyncDownloader.ModuleDownloadsComplete(NetFileCache cache, Uri[] urls, String[] filenames, Exception[] errors)
at CKAN.NetAsyncDownloader.<>c__DisplayClass19_0.b__1(Uri[] _uris, String[] paths, Exception[] errors)
at CKAN.NetAsyncDownloader.FileDownloadComplete(Int32 index, Exception error)
at CKAN.NetAsyncDownloader.<>c__DisplayClass16_0.b__1(Object sender, AsyncCompletedEventArgs args)
at System.ComponentModel.AsyncCompletedEventHandler.Invoke(Object sender, AsyncCompletedEventArgs e)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()

OS: Windows 8.1 Pro x64

Okay, it's confirmed: Upgrade mods, and install at least one mod at the same time, get this:

Unhandled exception:
System.IO.IOException: The process cannot access the file 'C:\Users\FireFaced\AppData\Local\Temp\tmpB938.tmp' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at CKAN.NetAsyncDownloader.ModuleDownloadsComplete(NetFileCache cache, Uri[] urls, String[] filenames, Exception[] errors)
at CKAN.NetAsyncDownloader.c__AnonStorey2.<>m__1(Uri[] _uris, String[] paths, Exception[] errors)
at CKAN.NetAsyncDownloader.FileDownloadComplete(Int32 index, Exception error)
at System.ComponentModel.AsyncCompletedEventHandler.Invoke(Object sender, AsyncCompletedEventArgs e)
at System.Net.WebClient.OnDownloadFileCompleted(AsyncCompletedEventArgs e)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()

I'm on Win 10 Home x64

I actually got the same (with a different temp file name). Win7 64-bit.
Upgrading Chatterer and installing KAL9000

So, it's most versions of Windows.

@plague006 I don't think that's relevant, TBH. It seems to not matter which mod is installed/upgraded, just that you upgrade and install mods at the same time.

You're correct that it's not about which mods. I just provide information if it's available.

Okay, that's reasonable, since people ask for ALL THE DETAILS

Anybody? I REALLY just want to have CKAN manage mods properly.

@FireFaced @plague006 Does the .zip of the mod already exists in your CKAN/dowloads Folder before you install / update the mod? Does it still exists after the install / update ?

@Postremus, it wouldn't matter, the ZIP file has a different name in each version. Also, the mods I've been installing in the tests were never in my cache.

In my case the files weren't cached @Postremus, and the .zips are present after the transaction.

Ok, ckan is srupid.

----- Ursprüngliche Nachricht -----
Von: "Matthew" [email protected]
Gesendet: ‎19.‎08.‎2015 14:46
An: "KSP-CKAN/CKAN" [email protected]
Cc: "Martin Panzer" [email protected]
Betreff: Re: [CKAN] CKAN complains about temp files when upgrading a mod andinstalling another one at the same time (#1367)

In my case the files weren't cached @Postremus, and the .zips are present after the transaction.
—
Reply to this email directly or view it on GitHub.

@Postremus
Very srupid.

That was my mobil phone, not me. :)

----- Ursprüngliche Nachricht -----
Von: "FireFaced, AKA TheCrazyCarts" [email protected]
Gesendet: ‎19.‎08.‎2015 16:45
An: "KSP-CKAN/CKAN" [email protected]
Cc: "Martin Panzer" [email protected]
Betreff: Re: [CKAN] CKAN complains about temp files when upgrading a mod andinstalling another one at the same time (#1367)

@Postremus
Very srupid.
—
Reply to this email directly or view it on GitHub.

I know @Postremus

Tried another install + upgrade with the dev version you just posted, @Postremus. Results are below.

Install: Water Sounds
Upgrade: A visor for Valentina


Downloading "https://kerbalstuff.com/mod/1094/A visor for Valentina/download/1.01"
About to install...

  • WaterSounds 1.1

Downloading "https://kerbalstuff.com/mod/1094/A visor for Valentina/download/1.01"
Downloading "https://kerbalstuff.com/mod/823/Water Sounds/download/1.1"

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

**** Exception Text ****
CKAN.FileNotFoundKraken: Trying to install WaterSounds 1.1, but it's not downloaded or download is corrupted
at CKAN.ModuleInstaller.Install(CkanModule module, String filename)
at CKAN.ModuleInstaller.InstallList(ICollection1 modules, RelationshipResolverOptions options, IDownloader downloader) at CKAN.ModuleInstaller.InstallList(List1 modules, RelationshipResolverOptions options, IDownloader downloader)
at CKAN.Main.<>c__DisplayClass230_0.b__0()
at CKAN.Main.WasSuccessful(Action action)
at CKAN.Main.InstallList(HashSet`1 toInstall, RelationshipResolverOptions options, IDownloader downloader)
at CKAN.Main.InstallMods(Object sender, DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

Unhandled exception:
System.IO.IOException: The process cannot access the file 'C:\Users\FireFaced\AppData\Local\Temp\tmp6B83.tmp' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at CKAN.NetAsyncDownloader.ModuleDownloadsComplete(NetFileCache cache, Uri[] urls, String[] filenames, Exception[] errors)
at CKAN.NetAsyncDownloader.c__AnonStorey2.<>m__1(Uri[] _uris, String[] paths, Exception[] errors)
at CKAN.NetAsyncDownloader.FileDownloadComplete(Int32 index, Exception error)
at System.ComponentModel.AsyncCompletedEventHandler.Invoke(Object sender, AsyncCompletedEventArgs e)
at System.Net.WebClient.OnDownloadFileCompleted(AsyncCompletedEventArgs e)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()

Still getting this D:

I'm also seeing this issue. Has anyone confirmed that it _doesn't_ happen when only installing or only upgrading? I only see people confirming that is _does_ happen when doing both.

My initial guess was that AV software is locking the file based on the fact that it's a file that is created and then very soon after deleted. I've seen similar issues before. AV software is supposed to be nice about it, but many aren't.

@Kemp-J The point of a temp file is to be used for a bit, then deleted. But AV could be doing that. Also, for others: Workaround for now is just not to install AND upgrade mods in one changeset.

"Workaround for now is just not to install AND upgrade mods in one changeset."

Could that not be the internal solution CKAN uses?

What is to stop an update being done first then install mods once that has completely finished?

If the issue is installing and upgrading at the same time then just don't do that by coding the 'apply changes' section of code to run twice, one for upgrade, one for install.

Then it does not matter what causes the bug as the trigger for the cause is avoided.

Still occurs. If this is going to be thrown under the bus as "won't fix", then make CKAN not allow the user to both select a mod to install while upgrades are selected. That _should_ be doable with a few appropriately placed conditionals.

At least until the issue is found and resolved -- noticed that this is being looked at despite the searched ones being listed 'closed'.

Unhandled exception:
System.IO.IOException: The process cannot access the file 'C:\Users\xxxx\AppData\Local\Temp\tmpD6DE.tmp' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalDelete(String path, Boolean checkHost)
   at CKAN.NetAsyncDownloader.ModuleDownloadsComplete(NetFileCache cache, Uri[] urls, String[] filenames, Exception[] errors)
   at CKAN.NetAsyncDownloader.<DownloadModules>c__AnonStorey2.<>m__1(Uri[] _uris, String[] paths, Exception[] errors)
   at CKAN.NetAsyncDownloader.FileDownloadComplete(Int32 index, Exception error)
   at System.ComponentModel.AsyncCompletedEventHandler.Invoke(Object sender, AsyncCompletedEventArgs e)
   at System.Net.WebClient.OnDownloadFileCompleted(AsyncCompletedEventArgs e)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch() 

What makes you think this has been given a "won't fix" label? Look at the labels on this issue - Bug, CKAN.DLL, and urgent. There's a workaround, and we are giving out that advice until its gets fixed, but this is definitely going to be fixed.

It's quite common in bug tracking systems to close off duplicates of accepted bug reports, retaining the one that has the most useful information.

Bump

This bug is still alive and well as of March 2018, ckan version 1.24.0.

@tjanke42 , obviously, the issue status says "Open". Please don't "Bump".

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DasSkelett picture DasSkelett  Â·  5Comments

JesusTheBird picture JesusTheBird  Â·  5Comments

core-code picture core-code  Â·  5Comments

motoboy98 picture motoboy98  Â·  6Comments

mactijn picture mactijn  Â·  4Comments