TShock icon indicating copy to clipboard operation
TShock copied to clipboard

Sending empty data to TShock Server can stop the server from accepting any new connections

Open EMREOYUN opened this issue 1 month ago • 5 comments

  • TShock version: 6.2.1.0
  • TShock build number (if known): Profoundly Collaborative (3.11)

Reproduction steps (if applicable)?

N/A

Any stack traces or error messages (if known)?

Invariant Failed: Error on message? IP:Port(Anonymous). System.IndexOutOfRangeException: Invalid packet. Message size too small (0)
    at Terraria.NetMessage.mfwh_CheckBytes(Int32 bufferIndex) on OTAPI:token 0x6000d04+0xfe

Any log messages from files that end in .log or .txt? What are the last 100 log messages from the server console?

2026-10-20 13:51:43 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 13:53:01 - <>c__DisplayClass1_0: ERROR: Failed to make request to other server, server is down?
2026-10-20 13:53:22 - <>c__DisplayClass2_0: ERROR: Failed to make request to other server, server is down?
2026-10-20 13:54:52 - ManageBot: INFO: [ManageBot] 
2026-10-20 13:54:52 - ManageBot: INFO: [ManageBot] Disconnecting
2026-10-20 13:54:52 - ManageBot: INFO: [ManageBot] Disconnected
2026-10-20 13:54:53 - ManageBot: INFO: [ManageBot] Connecting
2026-10-20 13:54:53 - ManageBot: INFO: [ManageBot] Resumed previous session
2026-10-20 13:54:53 - ManageBot: INFO: [ManageBot] Connected
2026-10-20 13:55:56 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 13:56:10 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:00:48 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:01:02 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:03:48 - GetDataHandlers: INFO: [Redacted] authenticated successfully as user [Redacted].
2026-10-20 14:03:51 - HandlerCollection`1: INFO: [Redacted] (x.x.x.x) from 'default' group joined. (1/31)
2026-10-20 14:03:51 - Utils: INFO: Broadcast: [Redacted] has joined.
2026-10-20 14:03:51 - TShock: INFO: [Redacted] has joined. IP: x.x.x.x
2026-10-20 14:03:52 - ExecutionContext: INFO: World saved at (/file/location/world.wld.2026-10-20T11.03.51Z.bak)
2026-10-20 14:03:52 - BackupManager: INFO: World backed up (/file/location/world.wld.2026-10-20T11.03.51Z.bak).
2026-10-20 14:03:59 - Commands: INFO: [Redacted] executed: /item life fruit 9999.
2026-10-20 14:04:00 - Bouncer: VERBOSE: Bouncer / OnNewProjectile please report to tshock about this! normally this is a reject from [Redacted] 982
2026-10-20 14:04:30 - Utils: INFO: Broadcast: [Redacted] has left.
2026-10-20 14:04:30 - HandlerCollection`1: INFO: [Redacted] disconnected.
2026-10-20 14:04:31 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:05:28 - <>c__DisplayClass1_0: ERROR: Failed to make request to other server, server is down?
2026-10-20 14:05:36 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:05:50 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:06:10 - <>c__DisplayClass2_0: ERROR: Failed to make request to other server, server is down?
2026-10-20 14:10:22 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:10:27 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:10:41 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:15:35 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:15:49 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:20:47 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:21:01 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:25:30 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:25:44 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:30:45 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:30:59 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:35:45 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:36:00 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:40:32 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:40:46 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:45:53 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:46:07 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:50:34 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:50:49 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:55:29 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 14:55:43 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:00:47 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:00:51 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:01:01 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:05:45 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:05:59 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:10:45 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:10:59 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:15:51 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:16:05 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:20:29 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:20:43 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:25:50 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:26:04 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:30:43 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:30:57 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:35:53 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:36:07 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:40:37 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:40:51 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:45:30 - ManageBot: INFO: [ManageBot] 
2026-10-20 15:45:30 - ManageBot: INFO: [ManageBot] Disconnecting
2026-10-20 15:45:30 - ManageBot: INFO: [ManageBot] Disconnected
2026-10-20 15:45:31 - ManageBot: INFO: [ManageBot] Connecting
2026-10-20 15:45:31 - ManageBot: INFO: [ManageBot] Connected
2026-10-20 15:45:31 - ManageBot: INFO: [ManageBot] Resumed previous session
                                                              2026-10-20 15:45:49 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:46:02 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:50:40 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:50:54 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:55:29 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 15:55:43 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 16:00:38 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 16:00:52 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 16:05:54 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 16:06:08 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 16:10:31 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 16:10:45 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 16:12:53 - ManageBot: INFO: [ManageBot] 
2026-10-20 16:12:53 - ManageBot: INFO: [ManageBot] Disconnecting
2026-10-20 16:12:53 - ManageBot: INFO: [ManageBot] Disconnected
2026-10-20 16:12:54 - ManageBot: INFO: [ManageBot] Connecting
2026-10-20 16:12:54 - ManageBot: INFO: [ManageBot] Resumed previous session
2026-10-20 16:12:54 - ManageBot: INFO: [ManageBot] Connected
2026-10-20 16:15:57 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 16:16:11 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 16:20:43 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 16:20:57 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 16:25:37 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 16:25:51 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 16:30:30 - ExecutionContext: INFO: World saved at (/file/location/world.wld)
2026-10-20 16:30:44 - ExecutionContext: INFO: World saved at (/file/location/world.wld)

What plugins and what versions of those plugins are you running?

[Server API] Info Plugin TShock v6.2.1.0 (by The TShock Team) initiated. [Server API] Info Plugin AdditionalPylons v1.2.1.0 (by ATSP / Updated for TShock 6.1) initiated. [Server API] Info Plugin BanWords v1.1.0 (by French Keno) initiated. [Server API] Info Plugin Bnnu's Revenge v1.0.1 (by Frenchatin) initiated. [Server API] Info Plugin CustomItems v1.4.3 (by Interverse, updated by Comdar + RenderBr + Maxthegreat99; TShock v6/net9 port by OpenAI) initiated. [Server API] Info Plugin Dimensions v1.5.0 (by popstarfreas) initiated. [Server API] Info Plugin EMREOYUN Plugin v1.0.0 (by EMREOYUN) initiated. [Server API] Info Plugin HistoryPro v1.6.1.2 (by Fixed by Frenchatin) initiated. [Server API] Info Plugin House Regions (Pro) v1.3 (by Frenchatin) initiated. [Server API] Info Plugin JourneyMixer v1.1 (by rustly) initiated. [ManageBot] Config loaded. [Server API] Info Plugin ManageBot v3.0.0 (by Frenchatin) initiated. [Server API] Info Plugin MapTeleport v1.0.0.0 (by Nova4334) initiated. [Server API] Info Plugin Multiserver Chat v1.1.0.0 (by Zack Piispanen, now maintained and updated by Ryozuki) initiated. [Server API] Info Plugin SummonLimit v1.5.0.0 (by Newy & EMREOYUN) initiated.

If I didn't provide any logs this issue, please close my issue immediately. I'm sorry for the inconvenience.

EMREOYUN avatar Oct 20 '26 21:10 EMREOYUN

I'm having the same issue. I'm using dimensions terrraria proxy to rate limit and filter IP's

CarotaCaditos avatar Oct 23 '26 03:10 CarotaCaditos

The following workaround solved this issue for me, adding - "-forceupdate" to my docker compose file. Or if you run via an exe: TerrariaServer.exe -forceupdate

@CarotaCaditos @EMREOYUN

AaronMarth avatar Oct 26 '26 20:10 AaronMarth

forceupdate

How can I add this into my existing docker. I use synology container manager

CarotaCaditos avatar Oct 27 '26 14:10 CarotaCaditos

Doesn't -forceupdate keep the server always active? Is there a way to solve this issue without time passing in-game and covering the whole world in Corruption/Crimson/Hallow?

Shenmue3 avatar Nov 10 '26 17:11 Shenmue3

I can reproduce this reliably, and it looks like a regression. Here's a minimal, plugin-free reproduction.

Environment

  • TShock 6.2.1.0 / Terraria 1.4.5.8 / OTAPI 3.3.14, Docker image ryshe/terraria:tshock-1.4.5.8-6.2.1, Debian 13 host
  • No plugins besides TShock itself
  • MaxSlots: 4, ReservedSlots: 0

Steps to reproduce

  1. Start the server and wait until it's listening.
  2. Open and immediately close a TCP connection five times, without sending any data:
    for i in 1 2 3 4 5; do nc -zv -w 2 <server-ip> 7777; sleep 2; done
    

Result

  • Connections 1–4 succeed, and the console prints <ip> is connecting... for each.
  • Connection 5 gets Connection refused.
  • Inside the container's network namespace, nothing is listening on the game port anymore (nsenter -t <pid> -n ss -tlnp shows no listener).
  • The process keeps running and other parts keep working (e.g. the UpdateManager logs every 5 minutes). No error or exception is logged.
  • The slots are never freed while no player is online. Only a restart brings the listener back.

So every connection that never completes the handshake permanently occupies a slot. Once all slots are taken, the server stops listening. With ReservedSlots set, it takes longer: a server with MaxSlots: 8 + ReservedSlots: 20 survived 12 such connections without issue.

Real-world trigger Any TCP health check (e.g. an Uptime Kuma "TCP Port" monitor) or internet port scanner will eventually lock up the server. In my case, a 10-minute TCP check took down a 4-slot server after exactly 4 checks.

Regression The same TCP check ran every 10 minutes against TShock 6.1.0 / Terraria 1.4.5.6 for months: 99.95% uptime over 30 days (8 + 20 slots, daily restart), so slots were clearly freed back then. The failures started right after updating to 6.2.1.

On the -forceupdate workaround (untested by me) If cleanup of stale connections only happens in the world update loop, that would explain why it works: without players the loop is idle, so stale slots are never released. That fits the symptoms, but -forceupdate also keeps the world simulating while empty (time, spread etc.), so it's not a great permanent fix.

toxmac avatar Nov 10 '26 20:11 toxmac