SmartlyDressedGames / Unturned-3.x-Community

Community portion of the Unturned-3.x repo. If you have access to the source code you can find it here:
https://github.com/SmartlyDressedGames/Unturned-3.x/
85 stars 18 forks source link

`Level.ScanKnownLevels` fails to create a directory #4222

Closed DiFFoZ closed 10 months ago

DiFFoZ commented 10 months ago
20:40:57 INF][SDG.Unturned] Rocket Unturned v4.9.3.14 for Unturned v3.23.13.0
Unloading 5 Unused Serialized files (Serialized files now loaded: 0)
Unloading 2 unused Assets to reduce memory usage. Loaded Objects now: 2387.
Total: 38.463045 ms (FindLiveObjects: 0.092070 ms CreateObjectMapping: 0.059520 ms MarkObjects: 38.300105 ms  DeleteObjects: 0.010210 ms)

[20:40:57 ERR][SDG.Unturned] Caught exception loading levels in legacy per-server workshop Maps folder (/Servers/military1/Workshop/Maps):
[20:40:57 ERR][SDG.Unturned] Access to the path '/Servers/military1/Workshop/Maps' is denied.
[20:40:57 ERR][SDG.Unturned]   at System.IO.FileSystem.CreateDirectory (System.String fullPath) [0x00191] in <2161c9885dd04ff291b79db9349c4b9b>:0
  at System.IO.Directory.CreateDirectory (System.String path) [0x0002c] in <2161c9885dd04ff291b79db9349c4b9b>:0
  at SDG.Unturned.ReadWrite.createFolder (System.String path, System.Boolean usePath) [0x00018] in <c54ea8a9e34e46a7928fb025002c666b>:0
  at SDG.Unturned.Level.ScanKnownLevels () [0x00307] in <c54ea8a9e34e46a7928fb025002c666b>:0
[20:40:57 ERR][SDG.Unturned] Permission denied
NullReferenceException: Object reference not set to an instance of an object
  at SDG.Unturned.CommandWindow.LogError (System.Object text) [0x0001e] in <c54ea8a9e34e46a7928fb025002c666b>:0
  at SDG.Unturned.UnturnedLog.internalException (System.Exception e) [0x00027] in <c54ea8a9e34e46a7928fb025002c666b>:0
  at SDG.Unturned.UnturnedLog.internalException (System.Exception e) [0x0003a] in <c54ea8a9e34e46a7928fb025002c666b>:0
  at SDG.Unturned.UnturnedLog.exception (System.Exception e) [0x0000f] in <c54ea8a9e34e46a7928fb025002c666b>:0
  at SDG.Unturned.UnturnedLog.exception (System.Exception e, System.String message) [0x00006] in <c54ea8a9e34e46a7928fb025002c666b>:0
  at SDG.Unturned.Level.ScanKnownLevels () [0x0039d] in <c54ea8a9e34e46a7928fb025002c666b>:0
  at SDG.Unturned.Level.getLevels (SDG.Unturned.ESingleplayerMapCategory categoryFilter) [0x00000] in <c54ea8a9e34e46a7928fb025002c666b>:0
  at SDG.Unturned.Assets.AddMapSearchLocations () [0x00000] in <c54ea8a9e34e46a7928fb025002c666b>:0
  at SDG.Unturned.Assets+<LoadAllAssets>d__104.MoveNext () [0x001af] in <c54ea8a9e34e46a7928fb025002c666b>:0
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00026] in <8aebd7627ade4efeae84aca54d1d32ad>:0
SDGNelson commented 10 months ago

Dang, I had a call so I'm a bit late reviewing these issues. Phew for wrapping all the separate ScanKnownLevels sections in try-catch blocks!

Not sure why it would be getting permission denied when I think it created those folders before. Will investigate.

It shouldn't interrupt loading fortunately despite the error.

diogocarvalho19 commented 10 months ago

When my server starts, it stops with this error, and simply doesn't load

SDGNelson commented 10 months ago

OH DUH 🤦‍♂️ the game wasn't prefixing the game folder path to /Servers/... so it was looking in the operating system root. I think it works on Windows because it's automatically relative to the working directory?

I'm not sure why it would be blocking loading though. @diogocarvalho19 could you share your log file please in case there's a separate error that's blocking loading?

diogocarvalho19 commented 10 months ago

[2023-11-24 18:28:56] Reflect net invokables: 28ms [2023-11-24 18:28:56] Discovered assembly "Rocket.API, Version=4.9.3.4, Culture=neutral, PublicKeyToken=null" at "/home/untserver/serverfiles/Modules/Rocket.Unturned/Rocket.API.dll" [2023-11-24 18:28:56] Discovered assembly "Rocket.API, Version=4.9.3.4, Culture=neutral, PublicKeyToken=null" at "/home/untserver/serverfiles/Modules/Rocket.Unturned/Rocket.API.dll" [2023-11-24 18:28:56] Discovered assembly "Rocket.Core, Version=4.9.3.4, Culture=neutral, PublicKeyToken=null" at "/home/untserver/serverfiles/Modules/Rocket.Unturned/Rocket.Core.dll" [2023-11-24 18:28:56] Discovered assembly "Rocket.Core, Version=4.9.3.4, Culture=neutral, PublicKeyToken=null" at "/home/untserver/serverfiles/Modules/Rocket.Unturned/Rocket.Core.dll" [2023-11-24 18:28:56] Discovered assembly "Rocket.Unturned, Version=4.9.3.10, Culture=neutral, PublicKeyToken=null" at "/home/untserver/serverfiles/Modules/Rocket.Unturned/Rocket.Unturned.dll" [2023-11-24 18:28:56] Discovered assembly "Rocket.Unturned, Version=4.9.3.10, Culture=neutral, PublicKeyToken=null" at "/home/untserver/serverfiles/Modules/Rocket.Unturned/Rocket.Unturned.dll" [2023-11-24 18:28:56] Found 1 module(s): [2023-11-24 18:28:56] 0: "Rocket.Unturned" [2023-11-24 18:28:56] Unturned overriding Steam AppId with "304930" [2023-11-24 18:28:56] Game version: 3.23.13.0 Engine version: 2021.3.29f1 [2023-11-24 18:28:56] Executing 5 potential game command(s) from the command-line: [2023-11-24 18:28:56] Did not match "port:27015" with any commands [2023-11-24 18:28:56] Did not match "players:20" with any commands [2023-11-24 18:28:56] Did not match "-nographics" with any commands [2023-11-24 18:28:56] Did not match "pei" with any commands [2023-11-24 18:28:56] Did not match "batchmode" with any commands [2023-11-24 18:28:56] Successfully set map to Russia! [2023-11-24 18:28:56] Successfully set gamemode to normal! [2023-11-24 18:28:56] Successfully set name to [EU#1] UNTC4 Vanilla+ [ HOME & TPA & Keep Skills ]! [2023-11-24 18:28:56] Successfully set perspective to both! [2023-11-24 18:28:56] Successfully set max players to 50! [2023-11-24 18:28:56] Platform: LinuxServer [2023-11-24 18:28:56] Operating System: Linux 5.4 Ubuntu 20.04 64bit [2023-11-24 18:28:56] System Memory: 32017MB [2023-11-24 18:28:56] Rocket Unturned v4.9.3.10 for Unturned v3.23.13.0 [2023-11-24 18:28:56] Initialized module "Rocket.Unturned" [2023-11-24 18:28:56] Vanilla Built-in Assets added asset search location "/home/untserver/serverfiles/Bundles" [2023-11-24 18:28:56] Server Common (Legacy) added asset search location "/home/untserver/serverfiles/Bundles/Workshop/Content" [2023-11-24 18:28:56] Per-Server (Legacy) added asset search location "/home/untserver/serverfiles/Servers/untserver/Workshop/Content" [2023-11-24 18:28:56] Per-Server (Legacy) added asset search location "/home/untserver/serverfiles/Servers/untserver/Bundles" [2023-11-24 18:28:56] Discovered level "Alpha Valley" at "/home/untserver/serverfiles/Maps/Alpha Valley" [2023-11-24 18:28:56] Discovered level "Destruction" at "/home/untserver/serverfiles/Maps/Destruction" [2023-11-24 18:28:56] Discovered level "Germany" at "/home/untserver/serverfiles/Maps/Germany" [2023-11-24 18:28:56] Discovered level "Monolith" at "/home/untserver/serverfiles/Maps/Monolith" [2023-11-24 18:28:56] Discovered level "PEI" at "/home/untserver/serverfiles/Maps/PEI" [2023-11-24 18:28:56] Discovered level "Paintball_Arena_0" at "/home/untserver/serverfiles/Maps/Paintball_Arena_0" [2023-11-24 18:28:56] Discovered level "Russia" at "/home/untserver/serverfiles/Maps/Russia" [2023-11-24 18:28:56] Discovered level "Scope_Markers_Test" at "/home/untserver/serverfiles/Maps/Scope_Markers_Test" [2023-11-24 18:28:56] Discovered level "Tutorial" at "/home/untserver/serverfiles/Maps/Tutorial" [2023-11-24 18:28:56] Discovered level "Washington" at "/home/untserver/serverfiles/Maps/Washington" [2023-11-24 18:28:56] Discovered level "Yukon" at "/home/untserver/serverfiles/Maps/Yukon" [2023-11-24 18:28:56] Caught exception loading levels in legacy per-server workshop Maps folder (/Servers/untserver/Workshop/Maps): [2023-11-24 18:28:56] Access to the path '/Servers/untserver/Workshop/Maps' is denied. [2023-11-24 18:28:56] at System.IO.FileSystem.CreateDirectory (System.String fullPath) [0x00191] in <2161c9885dd04ff291b79db9349c4b9b>:0 at System.IO.Directory.CreateDirectory (System.String path) [0x0002c] in <2161c9885dd04ff291b79db9349c4b9b>:0 at SDG.Unturned.ReadWrite.createFolder (System.String path, System.Boolean usePath) [0x00018] in :0 at SDG.Unturned.Level.ScanKnownLevels () [0x00307] in :0 [2023-11-24 18:28:56] Permission denied [2023-11-24 18:28:56] NullReferenceException: Object reference not set to an instance of an object [2023-11-24 18:28:56] SDG.Unturned.CommandWindow.LogError (System.Object text) (at :0) SDG.Unturned.UnturnedLog.internalException (System.Exception e) (at :0) SDG.Unturned.UnturnedLog.internalException (System.Exception e) (at :0) SDG.Unturned.UnturnedLog.exception (System.Exception e) (at :0) SDG.Unturned.UnturnedLog.exception (System.Exception e, System.String message) (at :0) SDG.Unturned.Level.ScanKnownLevels () (at :0) SDG.Unturned.Level.getLevels (SDG.Unturned.ESingleplayerMapCategory categoryFilter) (at :0) SDG.Unturned.Assets.AddMapSearchLocations () (at :0) SDG.Unturned.Assets+d__104.MoveNext () (at :0) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <8aebd7627ade4efeae84aca54d1d32ad>:0)

Semidvista commented 10 months ago

When my server starts, it stops with this error, and simply doesn't load

My servers have exactly the same problem And exactly the same error in the logs

SDGNelson commented 10 months ago

Thanks - I guess the exception logging is throwing an exception

diogocarvalho19 commented 10 months ago

Any temporary solution or just an update?

SDGNelson commented 10 months ago

A .1 patch is now building/uploading and I expect I'll put it out right away.

ksdsksd mentions here https://github.com/SmartlyDressedGames/Unturned-3.x-Community/issues/4223#issuecomment-1825986941 creating the folder that it's incorrectly trying to create as a temporary workaround, but the patch should be out very soon.

diogocarvalho19 commented 10 months ago

Ok thanks

SDGNelson commented 10 months ago

Sorry for my mistake with the path and the unfortunate double exception causing it to break loading. This should now be fixed in the .1 patch!

diogocarvalho19 commented 10 months ago

It worked here, thanks for the help!

DiFFoZ commented 10 months ago

Thanks, it's fixed