Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
CKAN creates a
<KSP>/CKAN/registry.locked
file when it loads an instance and deletes this file at exit. If CKAN terminates abnormally (e.g.,pkill -KILL mono
), then theregistry.locked
file can be left behind without a running CKAN. To make this condition detectable, the file contains the process ID of the CKAN process that created it.Problem
If you have a stale lock file and you start CKAN, the staleness is not detected. The lock file dialog appears even though there is no process with the process ID contained in the lock file.
Cause
#2139 was supposed to address this, but it had a bug:
CKAN/Core/Registry/RegistryManager.cs
Line 171 in cd7c3a0
That function takes the
<KSP>/CKAN
dir path as a parameter:CKAN/Core/Registry/RegistryManager.cs
Lines 46 to 54 in cd7c3a0
... but we're passing the path to the
registry.json
file, so the file path that we look for is<KSP>/CKAN/registry.json/registry.locked
:CKAN/Core/Registry/RegistryManager.cs
Line 62 in cd7c3a0
GameInstance.cs
uses it correctly:CKAN/Core/GameInstance.cs
Lines 84 to 91 in cd7c3a0
Changes
CheckStaleLock
passes the path to the CKAN dir as intended, so the lock file deletion takes placeRegistryManager.ksp
is renamedgameInstance
InstanceRegistryLockPath
andIsInstanceMaybeLocked
are renamed frompath
tockanDirPath
to make it easier to know the correct thing to passFixes #3686.