Unable to start tModLoader server since 2.6 update

OS Name/Version: Ubuntu 22.04.5

Product Name/Version: Phobos 2.6 - 20241025.4

Problem Description: tModLoader servers give “Out of Memory” error when starting after updating AMP to 2.6

This issue applies both to a server I’ve been using for a few months and a fresh instance I created in order to try and resolve the issue.

Output from the old server:

[10:03:03.978] [Main Thread/INFO] [tML]: Starting tModLoader server 1.4.4.9+2024.08.3.2|2024.08|stable|Stable|e139bc1c3dcd5fabf6865fbc3de4fe88be9f9ca2|5250319477331921743 built 9/30/2024 9:18 PM
[10:03:03.985] [Main Thread/INFO] [tML]: Log date: 10/28/2024
[10:03:03.985] [Main Thread/INFO] [tML]: Running on Linux (v6.8.0.47) X64 NetCore 8.0.4
[10:03:03.989] [Main Thread/INFO] [tML]: CPU: 4 processors. RAM: 256.0 MB
[10:03:03.989] [Main Thread/INFO] [tML]: FrameworkDescription: .NET 8.0.4
[10:03:03.989] [Main Thread/INFO] [tML]: Executable: /home/amp/.ampdata/instances/OBFUSCATEDFORPRIVACY/tModLoader/serverfiles/tModLoader.dll
[10:03:03.989] [Main Thread/INFO] [tML]: Working Directory: /home/amp/.ampdata/instances/OBFUSCATEDFORPRIVACY/tModLoader/serverfiles
[10:03:03.990] [Main Thread/INFO] [tML]: Launch Parameters: -server -seed PoweredByAMP -autocreate 3 -worldname world -tmlsavedirectory ModLoader/Worlds -announcementboxrange -1 -players 8 -port 7777 -config tmodloader14serverconfig.txt
[10:03:03.992] [Main Thread/INFO] [tML]: Parsed Launch Parameters: -server -seed PoweredByAMP -autocreate 3 -worldname world -tmlsavedirectory ModLoader/Worlds -announcementboxrange -1 -players 8 -port 7777 -config tmodloader14serverconfig.txt
[10:03:04.235] [Main Thread/INFO] [tML]: Saves Are Located At: /home/amp/.ampdata/instances/OBFUSCATEDFORPRIVACY/tModLoader/serverfiles/ModLoader/Worlds
[10:03:04.603] [Main Thread/INFO] [tML]: Distribution Platform: Steam. Detection method: Terraria.exe or Terraria_v1.4.4.9.exe not found nearby
[10:03:04.610] [Main Thread/DEBUG] [tML]: Native Resolve: FNA, Version=23.10.0.0, Culture=neutral, PublicKeyToken=null -> SDL2
[10:03:04.610] [Main Thread/DEBUG] [tML]: 	attempting load /home/amp/.ampdata/instances/OBFUSCATEDFORPRIVACY01/tModLoader/serverfiles/Libraries/Native/Linux/libSDL2-2.0.so.0
[10:03:04.610] [Main Thread/DEBUG] [tML]: 	success
[10:03:04.677] [Main Thread/INFO] [tML]: Current 1281930 Workshop Folder Directory: steamapps/workshop
[10:03:06.076] [Main Thread/DEBUG] [tML]: Network compatibility version is 2024.8.3
[10:03:07.304] [Main Thread/INFO] [tML]: Finding Mods...
[10:03:09.043] [Main Thread/INFO] [tML]: tModLoader RAM usage during OutOfMemoryException: 360.8 MB
[10:03:09.055] [Main Thread/WARN] [tML]: Silently Caught Exception: 
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Collections.Generic.Dictionary`2.Resize(Int32 newSize, Boolean forceNewHashCodes)
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at Terraria.ModLoader.Core.TmodFile.Read()
   at Terraria.ModLoader.Core.TmodFile.Open()
   at Terraria.ModLoader.Core.ModOrganizer.TryReadLocalMod(ModLocation location, String fileName, LocalMod& mod)
   at Terraria.ModLoader.Core.ModOrganizer.ReadModFiles(ModLocation location, IEnumerable`1 fileNames)+MoveNext()
   at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
   at Terraria.ModLoader.Core.ModOrganizer.FindAllMods()
   at Terraria.ModLoader.ModLoader.Load(CancellationToken token)
   at Terraria.ModLoader.ModLoader.Reload()
   at Terraria.Main.DedServ()
   at Terraria.Program.RunGame()
   at Terraria.Program.LaunchGame_(Boolean isServer)
   at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
   at Terraria.MonoLaunch.Main_End(String[] args)
   at Terraria.MonoLaunch.<>c__DisplayClass1_0.<Main>b__1()
   at Terraria.MonoLaunch.Main(String[] args)

[10:03:09.056] [Main Thread/FATAL] [tML]: Game ran out of memory. You'll have to find which mod is consuming lots of memory, and contact the devs or remove it.

Output from the new server:

[10:04:31.060] [Main Thread/INFO] [tML]: Starting tModLoader server 1.4.4.9+2024.08.3.2|2024.08|stable|Stable|e139bc1c3dcd5fabf6865fbc3de4fe88be9f9ca2|5250319477331921743 built 9/30/2024 9:18 PM
[10:04:31.066] [Main Thread/INFO] [tML]: Log date: 10/28/2024
[10:04:31.066] [Main Thread/INFO] [tML]: Running on Linux (v6.8.0.47) X64 NetCore 8.0.4
[10:04:31.069] [Main Thread/INFO] [tML]: CPU: 4 processors. RAM: 256.0 MB
[10:04:31.069] [Main Thread/INFO] [tML]: FrameworkDescription: .NET 8.0.4
[10:04:31.069] [Main Thread/INFO] [tML]: Executable: /home/amp/.ampdata/instances/OBFUSCATEDFORPRIVACY01/tModLoader/serverfiles/tModLoader.dll
[10:04:31.069] [Main Thread/INFO] [tML]: Working Directory: /home/amp/.ampdata/instances/OBFUSCATEDFORPRIVACY01/tModLoader/serverfiles
[10:04:31.069] [Main Thread/INFO] [tML]: Launch Parameters: -server -seed PoweredByAMP -autocreate 3 -worldname world -tmlsavedirectory ModLoader/Worlds -announcementboxrange -1 -players 8 -port 7780 -config tmodloader14serverconfig.txt
[10:04:31.071] [Main Thread/INFO] [tML]: Parsed Launch Parameters: -server -seed PoweredByAMP -autocreate 3 -worldname world -tmlsavedirectory ModLoader/Worlds -announcementboxrange -1 -players 8 -port 7780 -config tmodloader14serverconfig.txt
[10:04:31.299] [Main Thread/INFO] [tML]: Saves Are Located At: /home/amp/.ampdata/instances/OBFUSCATEDFORPRIVACY01/tModLoader/serverfiles/ModLoader/Worlds
[10:04:31.663] [Main Thread/INFO] [tML]: Distribution Platform: Steam. Detection method: Terraria.exe or Terraria_v1.4.4.9.exe not found nearby
[10:04:31.670] [Main Thread/DEBUG] [tML]: Native Resolve: FNA, Version=23.10.0.0, Culture=neutral, PublicKeyToken=null -> SDL2
[10:04:31.671] [Main Thread/DEBUG] [tML]: 	attempting load /home/amp/.ampdata/instances/OBFUSCATEDFORPRIVACY01/tModLoader/serverfiles/Libraries/Native/Linux/libSDL2-2.0.so.0
[10:04:31.671] [Main Thread/DEBUG] [tML]: 	success
[10:04:31.736] [Main Thread/INFO] [tML]: Current 1281930 Workshop Folder Directory: steamapps/workshop
[10:04:33.191] [Main Thread/DEBUG] [tML]: Network compatibility version is 2024.8.3
[10:04:34.454] [Main Thread/INFO] [tML]: Finding Mods...
[10:04:34.465] [Main Thread/INFO] [tML]: Finding Mods...
[10:04:34.477] [Main Thread/INFO] [tML]: Constructing Mods...
[10:04:34.480] [Main Thread/INFO] [tML]: JITModsAsync completed in 0ms
[10:04:34.482] [Main Thread/INFO] [tML]: Adding Content: ModLoader (tModLoader) v2024.8.3.2
[10:04:34.526] [Main Thread/INFO] [tML]: Resizing...
[10:04:34.642] [Main Thread/INFO] [tML]: Configuring Content: ModLoader (tModLoader) v2024.8.3.2
[10:04:34.719] [Main Thread/INFO] [tML]: Finalizing Content: ModLoader (tModLoader) v2024.8.3.2
[10:04:34.808] [Main Thread/INFO] [tML]: RAM physical: tModLoader usage: 372.3 MB, All processes usage: 12.4 GB, Available: -12.2 GB, Total Installed: 256.0 MB
[10:04:34.808] [Main Thread/INFO] [tML]: RAM virtual: tModLoader usage: 368.5 MB, All processes usage: 16.7 GB
[10:04:34.809] [Main Thread/WARN] [tML]: Total system memory usage exceeds installed physical memory, tModLoader will likely experience performance issues due to frequent page file access.
[10:04:34.908] [Main Thread/DEBUG] [tML]: GlobalItem registration stats. Count: 1, Slots per Entity: 1
	Instanced: 1, Conditional with slot: 0, Conditional by type: 0, Applies to single type: 0
	List Permutations: 1, Est Memory Consumption: 16 bytes
[10:04:34.935] [Main Thread/DEBUG] [tML]: GlobalNPC registration stats. Count: 2, Slots per Entity: 1
	Instanced: 1, Conditional with slot: 0, Conditional by type: 0, Applies to single type: 0
	List Permutations: 1, Est Memory Consumption: 16 bytes
[10:04:34.945] [Main Thread/DEBUG] [tML]: GlobalProjectile registration stats. Count: 0, Slots per Entity: 0
	Instanced: 0, Conditional with slot: 0, Conditional by type: 0, Applies to single type: 0
	List Permutations: 0, Est Memory Consumption: 0 bytes
[10:04:35.078] [Main Thread/INFO] [tML]: Adding Recipes...
[10:04:35.200] [Main Thread/INFO] [tML]: Mod Load Completed in 742ms
[10:04:35.203] [.NET TP Worker/INFO] [Terraria]: Loading World: world, IsCloud=False, Width: 1, Height: 1, Evil: 0, GameMode: 0
[10:04:35.224] [.NET TP Worker/INFO] [tML]: Creating world - Seed: 1235058432, Width: 8400, Height: 2400, Evil: -1, IsExpert: False
[10:04:35.231] [.NET TP Worker/INFO] [Terraria]: Generating World: world
[10:04:35.237] [Main Thread/INFO] [StatusText]: 0.0% -  - 0.
[10:04:35.238] [Main Thread/INFO] [StatusText]: 0.0% - Generating world terrain - 0.
[10:04:35.341] [.NET TP Worker/INFO] [tML]: tModLoader RAM usage during OutOfMemoryException: 356.2 MB
[10:04:35.351] [.NET TP Worker/WARN] [tML]: Silently Caught Exception: 
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at Terraria.TileData`1.SetLength(UInt32 len)
   at Terraria.TileData`1..cctor()
   at Terraria.TileData`1.get_ptr()
   at Terraria.Tile.set_HasTile(Boolean value)
   at Terraria.Tile.active(Boolean active)
   at Terraria.GameContent.Biomes.TerrainPass.FillColumn(Int32 x, Double worldSurface, Double rockLayer)
   at Terraria.GameContent.Biomes.TerrainPass.ApplyPass(GenerationProgress progress, GameConfiguration configuration)
   at Terraria.WorldBuilding.GenPass.Apply(GenerationProgress progress, GameConfiguration configuration)
   at Terraria.WorldBuilding.WorldGenerator.GenerateWorld(GenerationProgress progress)
   at Terraria.WorldGen.GenerateWorld_RunTasksAndFinish(Int32 seed, Stopwatch generationStopwatch, GenerationProgress customProgressObject)
   at Terraria.WorldGen.GenerateWorld(Int32 seed, GenerationProgress customProgressObject)
   at Terraria.IO.WorldFile.LoadWorld(Boolean loadFromCloud)
   at Terraria.WorldGen.serverLoadWorldCallBack()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

[10:04:35.351] [.NET TP Worker/FATAL] [tML]: Game ran out of memory. You'll have to find which mod is consuming lots of memory, and contact the devs or remove it.

Steps to reproduce:

  • Create fresh tModLoader instance
  • Attempt to start server
  • Out of Memory error is given.

Actions taken to resolve so far:

  1. Restored a known working backup
  2. Disabled mods on old server
  3. Switched instance to use a Docker container (it normally does not)
  4. Created fresh testing instance

Now that I’m getting a better look at the logs from pasting them into here, both instances seem to think they’re now limited to 4 CPU cores and 256 MB of RAM, however the instance managers for both are showing uncapped RAM.

Known issue with the .NET 8 implementation in AMP

You can try running it in docker with the custom image greelan/amp:ubuntu to get around it

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.