crowbarmaster / BedrockManagementService

A multiple host, multiple server, Minecraft bedrock server management service and GUI manager.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BDS update looping due to change in version string format.

crowbarmaster opened this issue · comments

Clean install of new service yesterday failed to start completely. Service extracts server as it should, but instead of launching newly deployed server, service proceeds to find new server out-of-date, causing the service to loop the update process. Issue has been identified as a change to the version string format printed from the server with beta versions. Example of such a version would be the latest public version as of 06\06\2022: 1.19.10-beta20. The downloaded filename contains the version string of 1.19.10.20. This difference means that the comparison of the running version and latest file are different and will never qualify as "up-to-date". A working fix has been written and will be tested and deployed, when time permits.

Might be related, I'm trying to manually apply the 1.19.20.02 update by stopping the service, copying the files over and overwriting all but allowlist, permissions, and server.properties, and restarting the service. This has worked in the past but now both the management service client and my Minecraft client are saying the server is still version 1.19.11.01 and outdated

Update, I was able to log in to the server by manually changing SelectedServerVersion to 1.19.20.02. However, this in turn causes the service to crash when it restarts.

I got it to run, but as soon as the backup occurred, it crashed because a version string somewhere has “-beta” in it. So unfortunately, I am back to running BDS in a command prompt.

@crowbarmaster - I know you might be busy with your daytime job, but perhaps you could take a quick look? I might try to see if I can build from source, but I haven't developed on Windows in a very long time (decades). I don't even know where to begin to get setup with Visual Studio, but given enough time, I might be able to figure it out.

Unfortunately 1.19.21.01 doesn't fix the backup crash, and there is still some 1.0.0-beta version string in BDS.

[8/25/2022 4:48:06 PM] Service: Error with Backup: Error converting value "1.0.0-beta" to type 'System.Collections.Generic.List`1[System.Int32]'. Path 'dependencies[0].version', line 24, position 29. at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at BedrockService.Shared.PackParser.MinecraftPackParser.ParseDirectory(String directoryToParse)
at BedrockService.Shared.Utilities.FileUtilities.CreatePackBackupFiles(String serverPath, String levelName, ZipArchive destinationArchive)
at BedrockService.Shared.Utilities.FileUtilities.AppendServerPacksToArchive(String serverPath, ZipArchive backupZip, DirectoryInfo levelDirInfo)
at BedrockService.Service.Server.BackupManager.PerformBackup(String queryString) in D:\a\BedrockManagementService\BedrockManagementService\BedrockService\Service\Server\BackupManager.cs:line 67

Long awaited, it's here! Give the latest build a try. I know I've been quiet, but once in a while I found bits of time to tackle this. There is a bit of everything in this, done bits at a time. It's totally possible I really eff'd something up, but it seems to work well on my end. There is still a couple actions that will still trigger high mem usage. I will have to dig deeper for that. Let me know how it goes!

Something's still going wrong related to the version numbers. Even with the new build I have to take the following steps whenever the service/computer restarts to avoid an error 1064:

  1. Open C:\Program Files\Bedrock Management Service\BmsConfig\ServerConfigs\<serverName>.conf
  2. Change SelectedServerVersion from the actual version (1.19.21.01 as of writing) to 1.19.11.01, which matches DeployedVersion down at the bottom.
  3. Save the file as admin and start the service.
  4. Open the BMS client and connect to the server.
  5. Open 'Edit BDS/BMS configs'>'Edit BMS server properties'
  6. Change SelectedServerVersion back to the latest version and save
  7. Restart the server from the button in the BMS client

Happy to provide logs or conf files if you'd like to take a look at them!

Now that you mention it, it would seem that DeployedVersion is not updating anymore as it should. I will dig into that a bit as that is going to hang server startup for sure. I will dig into that tonight, granted time permits.

I added a missing call to save the server config file after pushing a new build, I pushed a new version up! That may fix everything, get back to me!

Still crashing, here's the stack trace when I run the service from cmd:

C:\Program Files\Bedrock Management Service>BedrockService.Service.exe
Configuration Result:
[Success] Name BedrockService
[Success] Description Windows Service Wrapper for Windows Bedrock Server
[Success] ServiceName BedrockService
Topshelf v4.3.0.0, .NET 6.0.8 (6.0.8)
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Program Files\Bedrock Management Service
Service: Starting service...
Service: Loaded Service props.
Service: Core file(s) found missing. Rebuilding!
Service: Extracting server files to build core files, 0% completed...
Service: Extracting server files to build core files, 17% completed...
Service: Extracting server files to build core files, 33% completed...
Service: Extracting server files to build core files, 50% completed...
Service: Extracting server files to build core files, 67% completed...
Service: Extracting server files to build core files, 83% completed...
Service: Extraction completed.
Service: Now building necessary files
Service: Error extracting core files. Verify build archive "Update_1.19.21.01.zip" exists in BDSBuilds folder!
Service: Loaded config for server serverName.
Service: Exception occured Main : One or more errors occurred. (One or more errors occurred. (Could not find key default-player-permission-level in server property list!))
Topshelf.Hosts.ConsoleRunHost Error: 0 : An exception occurred, System.AggregateException: One or more errors occurred. (One or more errors occurred. (Could not find key default-player-permission-level in server property list!))
 ---> System.AggregateException: One or more errors occurred. (Could not find key default-player-permission-level in server property list!)
 ---> System.FormatException: Could not find key default-player-permission-level in server property list!
 ---> System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.ThrowHelper.ThrowNoMatchException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at BedrockService.Shared.Classes.ServerConfigurator.GetProp(String key)
   --- End of inner exception stack trace ---
   at BedrockService.Shared.Classes.ServerConfigurator.GetProp(String key)
   at BedrockService.Shared.Classes.ServerConfigurator.GetOrCreatePlayer(String xuid, String username)
   at BedrockService.Service.Management.ConfigManager.<>c__DisplayClass20_0.<LoadPlayerDatabase>b__6(String[] x) in D:\a\BedrockManagementService\BedrockManagementService\BedrockService\Service\Management\ConfigManager.cs:line 357
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at BedrockService.Service.Management.ConfigManager.LoadPlayerDatabase(IServerConfiguration server) in D:\a\BedrockManagementService\BedrockManagementService\BedrockService\Service\Management\ConfigManager.cs:line 356
   at BedrockService.Service.Management.ConfigManager.<LoadServerConfigurations>b__10_0() in D:\a\BedrockManagementService\BedrockManagementService\BedrockService\Service\Management\ConfigManager.cs:line 64
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at BedrockService.Service.Core.BedrockService.<Initialize>b__16_0() in D:\a\BedrockManagementService\BedrockManagementService\BedrockService\Service\Core\BedrockService.cs:line 62
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__272_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.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at BedrockService.Service.Core.BedrockService.Start(HostControl hostControl) in D:\a\BedrockManagementService\BedrockManagementService\BedrockService\Service\Core\BedrockService.cs:line 87
   at Topshelf.Builders.ControlServiceBuilder`1.ControlServiceHandle.Start(HostControl hostControl)
   at Topshelf.Hosts.ConsoleRunHost.Run()

Frankly it raises more questions than answers, because I have default-player-permission-level set to 'member' in my .conf file under the server section. Full file (with some names/ports changed) is attached.

serverName.conf.txt

Okay! That gave me all I need. The core files are needed to be the foundation for setting up array keys in prop lists. Without them, an error much like the one you pointed out will happen: :
'Error converting value "1.0.0-beta" to type 'System.Collections.Generic.List1[System.Int32]'. Path 'dependencies[0].version', line 24, position 29.'`

Given that, I went to the CoreFiles folder for this version, Empty. So browsing the resource packs, I found this critter in a test package:

  "dependencies": [
    {
      // Minecraft native module
      "uuid": "b26a4d4c-afdf-4690-88f8-931846312678",
      "version": "1.0.0-beta"
    },
    {
      // GameTest native module
      "uuid": "6f4b6893-1bb6-42fd-b458-7fa3d0c89616",
      "version": "1.0.0-beta"
    }

I will try to come up with a custom handler for this exception tonight. Stay tuned!

Build is up! @tiamat2012 A quick look at your prior post above suggests this hack will fix that as well. Sorry it took so long guys, I had tried a handful of times to dig into this some, but didn't get far with it. I should hopefully find more help with work soon and in turn have actual free time again, lol.

Latest build starts/restarts fine for me. Thanks for building and maintaining such a useful tool!

@crowbarmaster The latest build also fixed the backup crash, so I am running on the service again! Thanks!

The client works, but for some reason, the resolution is insanely small for me (compare to the window in the background):

image

It's not a show stopper, I just have to squint hard! Running full screen doesn't increase the resolution. I wonder if I need an update to .NET or something?

I tried to go back to just the previous client, and the resolution was normal, but it doesn't connect to the service (you probably have a protocol/version check).

That was it. I updated .NET and rebooted and the client is now back to normal resolution 😄

Huh that's weird! Well as it happens I recently dropped desktop scaling from 125 back to 100%. I will push a build at 125% again and see if it looks like it used to! Good to hear all is working again though!

100% seems to be fine. I just have to remember when the resolution changes to update .NET. It's a 2019 server, so it doesn't automatically apply updates like Windows desktop.

Ah, gotcha. Well I can assure you they will not change again here. I run a 32" LCD and Windows defaulted to 125%. This was usable on the TV, but got annoying remoting from my laptop. I wish I had been here all along, lol. I believe this build should make good on everything here, I will leave it up for a few days and see how it goes!