KSP-CKAN / CKAN

The Comprehensive Kerbal Archive Network
https://forum.kerbalspaceprogram.com/index.php?/topic/197082-*
Other
1.98k stars 347 forks source link

Inconsistency Kraken when installing OuterPlanets #930

Open netkan-bot opened 9 years ago

netkan-bot commented 9 years ago

Issue by valuial Monday May 18, 2015 at 10:39 GMT # Sample: Friday Sep 13, 2013 at 22:58 GMT Originally opened as https://github.com/KSP-CKAN/CKAN-support/issues/150


During the installation process when updating Outer Planets mod CKAN throws CKAN.InconsistentKraken. Some kind of dialog for the user to choose how to solve the inconsistency (decide to keep KopernicusTech or keep OuterPlanetsMod in this case) would be nice.

************** Exception Text **************
The following inconsistencies were found:
KopernicusTech conflicts with OuterPlanetsMod. at CKAN.SanityChecker.EnforceConsistency(IEnumerable1 modules, IEnumerable1 dlls)
at CKAN.RelationshipResolver..ctor(ICollection1 modules, RelationshipResolverOptions options, Registry registry, KSPVersion kspversion) at CKAN.ModuleInstaller.Upgrade(IEnumerable1 identifiers, NetAsyncDownloader netAsyncDownloader)
at CKAN.Main.InstallMods(Object sender, DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
fat-lobyte commented 9 years ago

The same happened to me when trying to update KerbalAlarmClock, for no apparent reason.

Your inconsistency detection is nice, but if you

That's pretty bad. I'd much rather have no detection than this kind.

In my case it was because I had the game running and the KerbalAlarmClock.dll was locked, apparently. But TBH the step from "has not been removed" to "is locked because the game is running" is a bit too far for the average users.

Please catch those InconsistencyKrakens and do something with them, or at least display a proper Error message and let the program continue if it can recover.

Informationen über das Aufrufen von JIT-Debuggen
anstelle dieses Dialogfelds finden Sie am Ende dieser Meldung.

************** Ausnahmetext **************
The following inconsistencies were found:
c:/program files (x86)/steam/SteamApps/common/Kerbal Space Program/GameData/TriggerTech/KerbalAlarmClock/KerbalAlarmClock.dll is registered to KerbalAlarmClock but has not been removed!   bei CKAN.Registry.DeregisterModule(KSP ksp, String module)
   bei CKAN.ModuleInstaller.Uninstall(String modName)
   bei CKAN.ModuleInstaller.AddRemove(IEnumerable`1 add, IEnumerable`1 remove)
   bei CKAN.ModuleInstaller.Upgrade(IEnumerable`1 modules, NetAsyncDownloader netAsyncDownloader)
   bei CKAN.Main.InstallMods(Object sender, DoWorkEventArgs e)
   bei System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

************** Geladene Assemblys **************
mscorlib
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.34209 built by: FX452RTMGDR.
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll.
----------------------------------------
ckan
    Assembly-Version: 0.0.0.0.
    Win32-Version: 0.0.0.0.
    CodeBase: file:///C:/Users/alexander/Software/KSP%20Mods/ckan.exe.
----------------------------------------
System.Windows.Forms
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.34250 built by: FX452RTMGDR.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll.
----------------------------------------
System.Drawing
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.34209 built by: FX452RTMGDR.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll.
----------------------------------------
System
    Assembly-Version: 4.0.0.0.
    Win32-Version: 4.0.30319.34239 built by: FX452RTMGDR.
pjf commented 9 years ago

@Valuial:

During the installation process when updating Outer Planets mod CKAN throws CKAN.InconsistentKraken

Drat. You should never be seeing these, as it indicates that we've somehow got ourselves into a state where dependencies haven't been met, or conflicting mods are installed. The way in which the GUI has handled inconsistencies has changed a number of times in the last few releases. I don't suppose you can provide us with:

Being able to reproduce this in particular would be amazing, since then we can both test for and fix the bug.


@fat-lobyte:

Your inconsistency detection is nice, but...

Your willingness to treat bugs as design decisions is quaint. The entire CKAN source is MIT licensed, and we're very happy receiving patches and encouraging of forks.

In my case it was because I had the game running.

This will be a Windows-specific error where files which are in use cannot be removed. I'll open a bug and write some test cases to examine our handling of this failure case.

valuial commented 9 years ago

Afaik I didn't pull in KopernicusTech manually, it must have come as a dependency of something. I moved to linux for ksp-stability and 64bit support shortly after. Starting with a new ksp stock install obviously.

valuial commented 9 years ago

Was a dll moved to its own package and only one of the two mods were updated to use the new package as dependency, where the other still wanted to install the dll itself?

Dazpoet commented 9 years ago

I'm ready to bet your problem originates from https://github.com/KSP-CKAN/NetKAN/pull/1188

Basically OPM changed from KopernicusTech to Kopernicus and we updated the metadata accordingly. In CKAN (and everywhere else) KopernicusTech and Kopernicus are not compatible on the same install so the Kraken is correctly thrown since we don't uninstall unused dependencies together with their mods this state of inconcistency occured during the upgrade of the mod.

I'm sorry that this caused grief to you but if it makes you any happier this'll be an awesome testcase to resolve the issue for all future users!

valuial commented 9 years ago

No grief, I knew how to help myself. This is all so you can further improve this wonderful piece of software.

Dazpoet commented 9 years ago

Did a single quick try at reproducing this locally and this seems to work on my machine:

1) Grab CKAN 1.6.18 and a clean install of KSP 1.0.2, my OS is Win 7 but should be OS independent 2) grab OPM 1.6.5 through commandline using ckan install OuterPlanetsMod=1.6.5 3) update to the latest OPM through ckan upgrade OuterPlanetsMod 4) InconsistentKraken is thrown

If someone can confirm that'd be awesome :)

Postremus commented 9 years ago

Confirmed on ckan 1.6.18, using ksp 1.0.2

2015-05-30 23:15 GMT+02:00 Willhelm Rendahl notifications@github.com:

Did a single quick try at reproducing this locally and this seems to work on my machine:

1) Grab CKAN 1.6.18 and a clean install of KSP 1.0.2, my OS is Win 7 but should be OS independent 2) grab OPM 1.6.5 through commandline using ckan install OuterPlanetsMod=1.6.5 3) update to the latest OPM through ckan upgrade OuterPlanetsMod 4) InconsistentKraken is thrown

If someone can confirm that'd be awesome :)

— Reply to this email directly or view it on GitHub https://github.com/KSP-CKAN/CKAN/issues/930#issuecomment-107087141.

valuial commented 9 years ago

Confirmed with Linux CLI

ckan 1.6.18, KSP 1.0.2, following Dazpoets steps

netkan-bot commented 9 years ago

Hey there! I'm a fun-loving automated bot who's responsible for making sure old support tickets get closed out. As we haven't seen any activity on this ticket for a while, we're hoping the problem has been resolved and I'm closing out the ticket automaically. If I'm doing this in error, please add a comment to this ticket to let us know, and we'll re-open it!

Famous-Shoes commented 9 years ago

For some time I was able to reproduce the inconsistency symptom as detailed above. However, now when clicking the installation checkbox next to OPM, CKAN throws an exception so I can't get far enough to see if this issue's originally described symptom is still there (note, KSPAPIExtensions is installed and everything in GameData is either stock or was installed by CKAN.)

CKAN version is 1.6.22, KSP 1.0.2 Win 32:

CKAN.ModuleNotFoundKraken: Cannot install KSPAPIExtensions, module not available
   at CKAN.CkanModule.FromIDandVersion(Registry registry, String mod, KSPVersion ksp_version)
   at CKAN.RelationshipResolver.<RelationshipResolver>c__AnonStorey0.<>m__0(String name)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at CKAN.RelationshipResolver..ctor(ICollection`1 moduleNames, RelationshipResolverOptions options, Registry registry, KSPVersion kspversion)
   at CKAN.MainModList.ComputeConflictsFromModList(Registry registry, IEnumerable`1 changeSet, KSPVersion ksp_version)
   at CKAN.Main.<UpdateChangeSetAndConflicts>c__async1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at CKAN.Main.<ModList_CellValueChanged>c__async0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__4(Object state)

PS Auto-closing issue reports after seven days of inactivity seems a bit harsh.

Dazpoet commented 9 years ago

Do you have KSPAPIExtensions installed through CKAN? That was removed a while back since we now expert mods to bundle it themselves.

pjf commented 9 years ago

PS Auto-closing issue reports after seven days of inactivity seems a bit harsh.

D'oh. The bot's not supposed to close active issues; it's still rather new and learning its way around.

Since we've got multiple confirms on this I'm moving this to a confirmed bug status.

pjf commented 9 years ago

Hooray! I get a different issue:

$ ckan.exe install OuterPlanetsMod=1.6.5
About to install...

 * OuterPlanetsMod 1.6.5
 * KopernicusTech 0.13
 * NearFutureSolar 0.5.1
 * TransferWindowPlanner v1.3.0.1 (cached)

(All installs fine)

$ ckan.exe upgrade OuterPlanetsMod

Upgrading modules...

Downloading "https://kerbalstuff.com/mod/437/Outer Planets Mod/download/1.7_Beta_2" (libcurl)
0 kbps - downloading - 0 MiB left - 100%              
Unhandled Exception:
CKAN.FileExistsKraken: Trying to write /home/pjf/.steam/steam/SteamApps/common/Kerbal Space Program/GameData/Kopernicus/Config/System.cfg but it already exists.
  at CKAN.ModuleInstaller.CopyZipEntry (ICSharpCode.SharpZipLib.Zip.ZipFile zipfile, ICSharpCode.SharpZipLib.Zip.ZipEntry entry, System.String fullPath, Boolean makeDirs) [0x00000] in <filename unknown>:0 
  at CKAN.ModuleInstaller.InstallModule (CKAN.CkanModule module, System.String zip_filename) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: CKAN.FileExistsKraken: Trying to write /home/pjf/.steam/steam/SteamApps/common/Kerbal Space Program/GameData/Kopernicus/Config/System.cfg but it already exists.
  at CKAN.ModuleInstaller.CopyZipEntry (ICSharpCode.SharpZipLib.Zip.ZipFile zipfile, ICSharpCode.SharpZipLib.Zip.ZipEntry entry, System.String fullPath, Boolean makeDirs) [0x00000] in <filename unknown>:0 
  at CKAN.ModuleInstaller.InstallModule (CKAN.CkanModule module, System.String zip_filename) [0x00000] in <filename unknown>:0 

So at least on my system we're seeing a conflict between the latest OPM and KopernicusTech 0.13.

Dazpoet commented 9 years ago

This issue was affected by https://github.com/KSP-CKAN/NetKAN/pull/1542 which was a response to #1083

Also we did a repackage to provide an upgradepath in https://github.com/KSP-CKAN/CKAN-meta/pull/583

Dazpoet commented 9 years ago

And I see now that we made an oops since the repackaged version did not include the changes from the netkan file... sigh

notifying @dbent

EDIT: That's what I get for skimming since I mixed the PRs up and yes, everything is nominal and I'll be getting my coffe now thank you -.-

pjf commented 9 years ago

@Dazpoet : You are the best. <3

Dazpoet commented 9 years ago

The overwriting conflict is because Kopernicus and KopernicusTech are basically the same filenames. I agree however that this is still a problem since we lack a good way to resolve this kind of situation and users end up in a suboptimal state which isn't obvious how to resolve.

I think that some combination of #978 and #1001 might be the answer we're looking for?

Famous-Shoes commented 9 years ago

@Dazpoet doesn't matter if I leave the KSPAPI that CKAN originally put in GameData, or remove it, or manually install it, the error is the same. This is also occurring when clicking on the install check box for Heat Control (I just happened to notice this today as I tried reinstalling Heat Control because attempting to upgrade it was throwing a consistency Kraken vs. Deadly Reentry, #1121.) Just let me know if I can dig up less unhelpful details or take some troubleshooting steps, or pull this into a separate issue--it does seem different, just noting it here because it's blocking me from testing whether the OP's issue still exists for me.

Update: also observed with Real Fuels.

Dazpoet commented 9 years ago

So I'm glancing through this because I've been away for a few days so not 100% up to date yet but I think the whole KSPAPI thing might be because you've had it installed at one point and never removed it in a way CKAN understood it as being removed. Can you try doing a ckan list in a terminal and see if that lists KSPAPIExtensions as installed and/or AD? If it's installed try doing a ckan remove KSPAPIExtensions which will erase it from the registry and should stop it from throwing weird errors.

Or I'm just spouting nonsense in which case I hope you'll bear with me and tell me what I misunderstood so we can track this down for real :)

Famous-Shoes commented 9 years ago

A couple days ago a refresh of the data fixed both the KSPAPI problems blocking me from the checking the OP's problem and either fixed the OP's problem or it was fixed a while back an I just couldn't tell. Today I upgraded to 1.6.23 and everything is still fine; I'm able to uninstall and install Outer Planets (and Real Fuels and Heat Control.)

Today I also checked if ckan thought it still had KSPAPI using ckan list and found it did. I removed it using ckan remove KSPAPIExtensions. Again, the problem went away before I removed ckan's old KSPAPI, but removing didn't seem to break anything new either.

Anyway, closed for me.

HebaruSan commented 4 years ago

Amazingly, an exception is still thrown on CKAN v1.27.2:

$ ckan.exe upgrade OuterPlanetsMod

Upgrading modules...

The following inconsistencies were found:
* KopernicusTech 0.13 conflicts with Kopernicus 2:release-1.8.1-1

  at CKAN.RelationshipResolver.ResolveStanza (System.Collections.Generic.IEnumerable`1[T] stanza, CKAN.SelectionReason reason, CKAN.RelationshipResolverOptions options, System.Boolean soft_resolve, System.Collections.Generic.IEnumerable`1[T] old_stanza) [0x005d6] in <9b67ba423ba146ae80055d24a9f0c7e7>:0 
  at CKAN.RelationshipResolver.Resolve (CKAN.CkanModule module, CKAN.RelationshipResolverOptions options, System.Collections.Generic.IEnumerable`1[T] old_stanza) [0x00045] in <9b67ba423ba146ae80055d24a9f0c7e7>:0 
  at CKAN.RelationshipResolver.AddModulesToInstall (System.Collections.Generic.IEnumerable`1[T] modules) [0x00189] in <9b67ba423ba146ae80055d24a9f0c7e7>:0 
  at CKAN.RelationshipResolver..ctor (System.Collections.Generic.IEnumerable`1[T] modulesToInstall, System.Collections.Generic.IEnumerable`1[T] modulesToRemove, CKAN.RelationshipResolverOptions options, CKAN.IRegistryQuerier registry, CKAN.Versioning.KspVersionCriteria kspversion) [0x00028] in <9b67ba423ba146ae80055d24a9f0c7e7>:0 
  at CKAN.RelationshipResolver..ctor (System.Collections.Generic.IEnumerable`1[T] modulesToInstall, System.Collections.Generic.IEnumerable`1[T] modulesToRemove, CKAN.RelationshipResolverOptions options, CKAN.IRegistryQuerier registry, CKAN.Versioning.KspVersionCriteria kspversion) [0x0004e] in <9b67ba423ba146ae80055d24a9f0c7e7>:0 
  at CKAN.ModuleInstaller.Upgrade (System.Collections.Generic.IEnumerable`1[T] identifiers, CKAN.IDownloader netAsyncDownloader, System.Collections.Generic.HashSet`1[System.String]& possibleConfigOnlyDirs, CKAN.RegistryManager registry_manager, System.Boolean enforceConsistency) [0x0001f] in <9b67ba423ba146ae80055d24a9f0c7e7>:0 
  at CKAN.CmdLine.Upgrade.RunCommand (CKAN.KSP ksp, System.Object raw_options) [0x003c2] in <9b67ba423ba146ae80055d24a9f0c7e7>:0 

But if you uninstall OPM, KopernicusTech ends up in the change set thanks to #2753:

$ ckan.exe remove OuterPlanetsMod
About to remove:

 * Outer Planets Mod 1.6.5
 * Module Manager 4.1.3
 * KopernicusTech 0.13

Continue? [Y/n] 

I guess the upgrade command would need access to that logic to resolve this.