crowbarmaster / BedrockManagementService

A multiple host, multiple server, Minecraft bedrock server management service and GUI manager.
Apache License 2.0
33 stars 5 forks source link

Fresh install not working #2

Closed tiamat2012 closed 2 years ago

tiamat2012 commented 2 years ago

Unfortunately, this new service isn't working well yet. I built a new Windows 2019 standard edition eval server (virtual machine) and attempted to use this service on it (v2.5 beta.zip).

Using all the defaults, running the BedrockService.Service in an admin CMD shell fails the first time, and then on the second launch a default minecraft server is started. Probably some missing files that get created during the first run, so not clean, but not a big deal either. Hooray!

The first issue was simply stopping the server. You cannot exit the server as the watchdog will prevent it. Pressing Control-C or sending the Stop command from the client will restart the server. You have to close the CMD prompt. If you attempt to install it as a service, it too will not stop under any circumstances until you reboot the server. I get you want to make the server resilient, but it's difficult to get it working with a new world. I have an existing 1.18 starter world (just a set seed, survival, with 2 resource packs) I want to run under a dedicated server. It was very difficult to even get that working. So for further testing, I tried to just use the randomly created creative world using all the defaults to see what works in the beta.

The client frequently drops connection and sometimes hangs. That's probably the top item in the TODO list, but it does it even if you just let it sit there after you connect. Sometimes everything is dimmed out and you have to restart the client to be able to connect again. Definitely some to-do work in your backlog.

The backup functionality doesn't seem to work at all. Either from the client UI (any of the backup buttons) or from the cron config in Globals.conf (changing the setting to true!). The expected backup functionality looks really nice, but unfortunately it's not working. That's pretty much a show stopper, as it's beta code and being able to backup and restore if something bad happens is pretty critical to your users.

Since I thought I would see what is working, I tried to add a user to the manager, and went back to the same screen and it was still blank. No permissions were granted on the server.

I believe some of the functionality is working for you as you are likely updating existing deployments with incremental changes. There are small tweaks and changes you may have made that aren't there in a completely new deployment.

It might help to start with a fresh eval server build using all the defaults and resolve some of these issues to help others adopt your software. I had been using your previous BedrockService until one day it seemed to stop working, and then reverted back to just running the bedrock_server in a command prompt and leaving the RDP session up and disconnected, and manually backing up the server every once in a while. Certainly not ideal, as the session could get dropped and the minecraft server go down (it's just a local family server).

Sorry to pack everything into 1 issue. I noticed you haven't received any feedback yet and wanted to know there is someone out there who would like to use your software. If you can at least get some of the basics working on a fresh install, and if there are some one off problems later, I could help submit individual tickets with logs as necessary. I really didn't see anything useful in the logs (client or service logs) yet to share with you.

Good luck and I may check back again later this month to see how things have progressed. Happy holidays!

crowbarmaster commented 2 years ago

Hello and I thank you for the excellent feedback!

I have not yet tried to run this under anything but Windows 10 1809 as of yet, but as we speak I have already downloaded a copy of Server 2019. I could use a few more details, are you using the desktop-enabled version or command line only? It may make a difference, and what VM do you use? I installed a fresh copy of 2019 Eval, installed a fresh copy of 2.5 Beta and attempted to launch for the first time, and it failed to run. So I did some investigating, and right now we are having issues checking the running status of threads. It also seems like if this were to be intermittent in your case, it could very well explain most of your issues listed above, as most of them require server restarts (for now) to work and will fail if the server doesn't stop. I have also tested a windows 10 build on a VM, and I found the same issue exists. I will be firing up my test machine in a few to install a fresh build of 2019 server on that, and give it a go on actual hardware. Life has dropped me a couple notches lately, or I would have had the time to fix this anyways. Threads are getting canned for cancelable tasks soon, and that will solve these issues anyways. Stay tuned, I will have more details soon!! Thanks bud!

tiamat2012 commented 2 years ago

Hi,

I am using the desktop install option so I can RDP into the server and manage it "the old way" like a regualr windows host. Command line Server using PowerShell is really just too hard to deal with and not really needed. I am using RH/CentOS ovirt as a virtual machine host running on a DL380 (so it's qemu-KVM), however, I really don't think this will matter. You can probably use the free vmware player.

Let me know if you need anything else from me.

tiamat2012 commented 2 years ago

The VM is setup with 4 virtual CPU's: 2 virtual sockets with 2 cores in each socket (no hyperthreading). 4 GB of allocated memory (which I can easily increase, but minecraft seems to work fine with 4 GB).

Also of note, I am running your bedrock client on the same server in the same RDP session. so everything is "local".

crowbarmaster commented 2 years ago

I run windows primarily as you would probably assume, and I do all of my VM work via VirtualBox with similar specs selected. It also looks like your gonna be excited for the future too! This project has migrated to .NET 6.0 Core, and that means mono and native linux support is a definite future! Seems like you actually need me to finish that really, so when find the time I will be working on that. As best as I can tell I actually just have your exact issue to change out (.NET 6.0 has dropped Abort() from threads) and it should be working again! I just have a handful of changes to make. You should be seeing something pretty soon! Thanks for being a supporter! BTW, may I ask if you can recall, what prior version did you use?

tiamat2012 commented 2 years ago

Bedrock's linux server is horrible. I tried for weeks to get it working and gave up. Performance is terrible when you do get it working and there are limitations that make it unusable (search the official mojang bug forums). I still have the VM's for it for 1.16 that are stopped. That's when I installed 2019 eval server and that works so much better. I don't know if you should waste your time trying to build your manager for it, since it may not get any use. I just have to rebuild my windows 2019 server every 180 days when the eval license expires, which is no big deal for a family vm server. I am always going to run Minecraft server as a VM, since it's on the basement server that runs a few other vm's (like a VyOS firewall). it's got 24 logical CPU's, 72GB of memory, and 2.4 TB of raw storage - got it off eBay a long time ago for I think about $700.

The old version was 1.3 installed March 2021. The last world backup from the tool is dated July 29, 2021.

Thanks for looking at the code and fixing the bugs.

BTW - you might check the minecraft 1.18 server.properties. There are 2 new keys in it now. It doesn't stop the server from starting if they are missing and I doubt people really change them, but it should be part of you next release.

crowbarmaster commented 2 years ago

Awesome info you've given me there, I had only known of a linux version's existence really, and it won't be a focus of mine to be exact. It just may end up being possible as a result of the new changes that have been made or due to take place. I actually plan to build a web client (Just started learning ASP and MVC), and possible a pair of Xamarin apps too. For now though, I am close to a new beta. I will post a build here for you to test soon!

crowbarmaster commented 2 years ago

Service layer is up and running with the newest changes! I have some loose ends to tie up yet, and the UI needs some newfound attention now as well: image

It won't take much to have this acting normally again. You should see this within the next few days or better, depending on life, lol. This was in a VM as well, so should be good for your needs!

crowbarmaster commented 2 years ago

Hello again! Spent a bit on this today, and I believe most things are buttoned up enough to test out on your end! For starters, you will need the "Windows hosting bundle" for the .NET 6.0 runtimes, and make sure your C++ runtimes are up to date (I needed them, too). I tested this in my VM and seems to work well. Most all features seem to work as intended with what time I have spent debugging. Let me know what you think! BMS_2.51Beta.zip

tiamat2012 commented 2 years ago

Hi,

I was slightly confused at first with the contents of the ZIP, but I see that net-6.0 folder is the service and net-6.0-windows is the client.

I searched for the hosting bundle and found this link as one of the top responses:

https://dotnet.microsoft.com/download/dotnet/3.1

It might be helpful to provide links so people don't install the wrong runtime...

Running the server without any NET packages results in this error:

C:\Minecraft-S\server>BedrockService.Service.exe A fatal error occurred. The required library hostfxr.dll could not be found. If this is a self-contained application, that library should exist in [C:\Minecraft-S\server]. If this is a framework-dependent application, install the runtime in the global location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\InstallLocation].

The .NET runtime can be found at:

So I went to that link. You have to pay attention and download the "Run Server Apps" Hosting Bundle (third option). The other 2 options will not work for the service (I tested them).

Service started up, and I could stop the server using Control-C. First hurdle fixed.

So I ran the server again in an admin CMD prompt and opened a second (normal) CMD for the client.

I get a pop-up saying "To run this application, you must install missing frameworks for .NET. Would you like to download it now?" Hmm - So it's looking for a different .NET runtime package for the client. Let's figure out which one.

I selected No. I then installed the Desktop runtime from the same place I downloaded the Hosting Bundle. That allows the client to run.

I clicked the Edit Server Config so I could setup the Default server so I could load my world. I changed gamemode = survival, difficulty = normal, tick-distance = 8, level-name and level-seed, and compression-threshold = 2048.

When I clicked Save, I got the following crash window:

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

** Exception Text ** System.NullReferenceException: Object reference not set to an instance of an object. at BedrockService.Client.Forms.MainWindow.EditCfg_Click(Object sender, EventArgs e) in C:\Users\Crowbar\source\repos\crowbarmaster\BedrockManagementService\BedrockService\Client\Forms\MainWindow.cs:line 287 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)

It seems like one end drops the connection from the other in the background when you have another window open (like Edit Server Config). I assume it's not sending the heartbeat response to let the server know it's still alive. On the server window it says:

Packet listener thread started. Client was disposed! Killing thread... HeartBeatSender started. Client was disposed! Killing thread...

I tried to change one setting at a time rather quickly and saving it and that seems to work ok. It still crashed if I take too long in the edit window to change a setting.

When the client dies like this, you have to restart the client. The server can also get into a weird state and have to be restarted. Unfortunately, in the last save, something bad happened, because now the config has been reset to all the defaults (per the server screen and the client screen and edit server settings window). Back to square one on that file.

I ran out of time to do any more testing tonight. I can't play a lot with this during the week nights (work during the day and family at night). I think you still have some testing to do with the client-server comms, and add some error handling so that if something bad happens, you don't fully reset the server.properties file back to all the defaults (or any file you are editing). Perhaps write a server.properties.new file and then stop, delete old if exists, rename current-> old, new -> current, start. This way if something bad happens when you are writing the new file, you might not wipe out the old file.

If I get a chance to test some of the other functionality, I will reply back with results. But with the disconnects, it's a little hard to test, because it only gives me a few seconds to make and save a change.

For info - I installed Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.30.30704. That's required by Minecraft, so it was installed last week. The only other thing I installed is Microsoft Edge because IE is well, IE.

tiamat2012 commented 2 years ago

50 seconds - no matter what you do, you got about 50 seconds to complete anything before the client will disconnect. Only when the connection resets (like after a Save and restart event) will the 50 second timeout restart.

crowbarmaster commented 2 years ago

Okay man, looks like even with the new changes, Tasks are getting desynced. Given this I completely rewrote the way I handle disconnects. This new build should prove to be a lot more connection happy: BMS_v2.52Beta.zip

tiamat2012 commented 2 years ago

Hi! The latest beta works much better!

I was able to use most of the functions without any issues. I could let it set for a bit and the connection between client and server would not drop (always local, I didn't test running the client on a separate computer from the server). I pretty much went through all the options, even deleting the Default world and creating a new world, editing the client config and changing it. I didn't install or edit the world with NBTStudio (no need plus I am not sure that it supports 1.18 yet). I also didn't configure or check the scheduled backups options in the global service settings. I may do that tonight and see if it works in the morning. I did make a few manual backups and restored one of them and that worked fine.

Only 1 significant bug that I found. I added 2 mcpacks to the world using the R/B Pack Manager and that worked fine (I selected them both from my Downloads folder and uploaded them, since you cannot browse and add one at a time - possible a minor bug to look at later). Afterward, when you click the R/B Pack Manager button, the server side log shows the 2 packs being found, but the client side hangs and doesn't show the pop-up window. You have to kill it with Task Manager or from the start bar -> Close Window.

If you create and maintain the world_resource_packs.json file with the right content in it in the right folder (same folder as the level.dat file), this will activate the various packs. Otherwise, the Pack Manager really only gets you so far. You could add a simple checkbox enable/disable editor for this file or simply enable all the packs that are installed on the server. You can google to see how to create that file from the manifest.json data files in the packs. It's a very simple json file. I copied that file from a regular minecraft world where I activated the same 2 packs and it worked fine on the server to activate the packs.

Another very minor bug is the width of the server config edit screen. Can you make the Value column slightly smaller in width so that when you enter in a value in that column, it doesn't scroll the window over so you cannot read the Entry names anymore. I just have to resize that column slightly and it works better. In simple terms, the scrollbar at the bottom of the window should not be visible when you first open the pop-up window.

With the core capabilities working in a CMD window, I thought I would go ahead and set it up as a background service. I ran:

BedrockService.Server.exe install

It started the server and then installed the service. I pressed Control-C to stop the server, and then ran net start bedrockservice to start up the background service. After that, it seemed to work fine. I think you just need to catch the install command line option and not start the server. The uninstall option had a slightly more strange output and also required a Control-C to end the program, but I think it also was trying to start the server.

All in all, I think you did a great job the last few days to get this working. If you want to tweak a few more things and have me test again, just let me know.

tiamat2012 commented 2 years ago

When I changed the backup to true, the schedule, and the backup directory (using the client Edit Globaql Service settings button), when the background service restarted, the service log says:

Error Starting BedrockServiceWrapper at System.ServiceProcess.ServiceBase.RequestAdditionalTime(Int32 milliseconds) at Topshelf.Runtime.Windows.WindowsServiceHost.Topshelf.HostControl.RequestAdditionalTime(TimeSpan timeRemaining) at BedrockService.Service.Core.BedrockService.Start(HostControl hostControl) in C:\Users\Crowbar\source\repos\crowbarmaster\BedrockManagementService\BedrockService\Service\Core\BedrockService.cs:line 57

I tried to do it again to see if I could repeat it, and unfortunately, this time the service went south. I tried to stop the service with net stop, and its just sitting at "Stopping" - time for a reboot... You might do some more testing with the background service trying to break things...

It's reproducable - just click Edit Global Service Settings, don't have to change anything, and then Save. Reconnect once it restarts and you will see that error in the service log window option. Once you do that, you cannot stop the background service anymore (without a reboot).

tiamat2012 commented 2 years ago

The start commands list is dropping the last command in the list (length -1 coding error?). So if you have just 1 command, it wont execute. 2 commands will execute just the first one, and 3 commands, it will execute the first 2. There is no way to delete a command in the list (just blanking them out works, but is not pretty).

At this point, do you want me to open separate issues for these smaller bugs or keep using this same thread?

crowbarmaster commented 2 years ago

Hey! Glad things are looking up! At this point, I would agree that separate issues would be good to post up. Sometimes having a chat about it can enlighten ideas about the feature itself I hadn't thought of. Also, if there is something you think should be in this, please let me know! I figure a handful of useful features I just haven't thought of could easily be included one day. Perhaps open those as feature/enhancement tagged issues. You can leave what is here alone, I will sift through and work it all out soon! It's quite nice to have some support with debugging, and I thank you!

crowbarmaster commented 2 years ago

Closed with Beta V 2.52 satisfying original issue.