Pryaxis / TShock

☕️⚡️TShock provides Terraria servers with server-side characters, anti-cheat, and community management tools.
GNU General Public License v3.0
2.41k stars 377 forks source link

Terraria won't work under Mono 4.2.1 #1143

Closed Fchen48 closed 8 years ago

Fchen48 commented 8 years ago

Hi,

I expected many bugs and lags under Mono 3.X and decided to update to a newer version.

# mono --version
Mono JIT compiler version 4.2.1 (Stable 4.2.1.102/6dd2d0d Thu Nov 12 09:52:44 UTC 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

# mono TerrariaServer.exe
TerrariaAPI Version: 1.22.0.0 (Protocol v1.3.0.8 (156))
SendQ edition
[Server API] Error Startup aborted due to an exception in the Server API initialization:
System.InvalidOperationException: Plugin "TShock" has thrown an exception during initialization. ---> System.Exception: Fatal TShock initialization exception. See inner exception for details. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
File name: 'System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
  at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract (System.Type objectType) <0x41228590 + 0x00067> in <filename unknown>:0
  at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract (System.Type objectType) <0x41222040 + 0x00273> in <filename unknown>:0
  at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract (System.Type type) <0x41221d30 + 0x00144> in <filename unknown>:0
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.GetContractSafe (System.Type type) <0x41221ce0 + 0x00044> in <filename unknown>:0
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, Boolean checkAdditionalContent) <0x412217d0 + 0x0006f> in <filename unknown>:0
  at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) <0x41220c90 + 0x00197> in <filename unknown>:0
  at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) <0x41220c60 + 0x0001b> in <filename unknown>:0
  at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) <0x4121f390 + 0x000e7> in <filename unknown>:0
  at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) <0x4121f320 + 0x0002f> in <filename unknown>:0
  at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value) <0x4121f250 + 0x00027> in <filename unknown>:0
  at TShockAPI.ConfigFile.Read (System.IO.Stream stream) <0x4121f0f0 + 0x00067> in <filename unknown>:0
  at TShockAPI.ConfigFile.Read (System.String path) <0x4121eff0 + 0x000a3> in <filename unknown>:0
  at TShockAPI.FileTools.SetupConfig () <0x4121eb10 + 0x000bb> in <filename unknown>:0
  at TShockAPI.TShock.Initialize () <0x4121adb0 + 0x00283> in <filename unknown>:0
  --- End of inner exception stack trace ---
  at TShockAPI.TShock.Initialize () <0x4121adb0 + 0x005a7> in <filename unknown>:0
  at TerrariaApi.Server.PluginContainer.Initialize () <0x4121ac80 + 0x00017> in <filename unknown>:0
  at TerrariaApi.Server.ServerApi.LoadPlugins () <0x41214b80 + 0x00cbf> in <filename unknown>:0
  --- End of inner exception stack trace ---
  at TerrariaApi.Server.ServerApi.LoadPlugins () <0x41214b80 + 0x00d93> in <filename unknown>:0
  at TerrariaApi.Server.ServerApi.Initialize (System.String[] commandLineArgs, Terraria.Main game) <0x41213000 + 0x0034b> in <filename unknown>:0
  at Terraria.ProgramServer.InnerStart (System.String[] args) <0x411d3f80 + 0x0014b> in <filename unknown>:0
chriseilander commented 8 years ago

I can get it to run on mono 4.2.1 on my Raspberry Pi, but whenever I try to connect to the server it stays stuck at "Server Found".

KingArty commented 8 years ago

I also have an issue with mono, but my mono installation is version 4.3.2, vanilla TShock 4.3.12.0 (Yoraiz0r R0cks) and the server runs on CentOS 6.7. The problem is that the client's "receiving tile data" commonly only gets to 40% then stops unexpectedly upon initially attempting to join the server. Installing WorldEdit and destroying the world fixed the issue, but reverting the change shows tiles to be loading at an extremely slow rate, a tile every minute or so. I will also note that using WorldEdit to place a 200 radius of platforms was nearly instantly applied, and manually placing tiles was possible. After messing with this for some time, my in-game "Receiving tile data:" rocketed to a whopping 1410760% and instantly froze the client. No errors in the server logs can be found. I wasn't sure where to look for an answer for this, and this issue was the only semi-relevant article that I could find. Is this something on TShock's end or something I have done wrong with setting up mono and what-not on my new server? I came here only because my 1.2.4.1 TShock installation works just fine on the same machine.

QuiCM commented 8 years ago

@Fchen48 Looks like your mono installation is not complete

@chriseilander We don't support devices like an RPi. Make sure there's nothing blocking connections, and that you have adequate RAM and CPU. Someone else on the team with more knowledge may be able to provide more insights.

@KingArty What do you mean by your 1.2.4.1 TShock installation? Could you provide the TShock version number please

KingArty commented 8 years ago

@WhiteXZ The version is 4.2.10.0 (Please take our survey etc.), I kept the 1.2 server running due to good player traffic. I have yet to test any plugins, but the vanilla 1.2 TShock seems to run perfectly. I'm about to begin transferring of said outdated plugins from my Windows 4.2.10.0 installation to see if they function correctly.

hakusaro commented 8 years ago

We're never going to backport fixes for previous versions of TShock that break protocol compatibility with Terraria.

Why?

KingArty commented 8 years ago

Quite right, the only way to downgrade Terraria is by manually replacing the files with an older version that was provided by Steam before the update, unless the user never authorized their Steam client to update it. In order to continue working with 1.2 plugins, backtracking on current projects that existed pre-1.3 can be done through the change logs on Github, which is the only way I've found to recover older builds without any posted releases or rewriting the plugin from scratch (Unfortunately some have private resources). I'm offering information on the functionality of 1.2 servers with my current mono installation, I am only attempting to gather information that can help solve the mono compatibility issues at this point. I need to further test to what degree my 1.2 server actually functions under my current build specifications to better understand what may be wrong. At this point I'm willing to offer access to my installation to help solve the issue as it is not in use due to mono issues and costing me money.

To put it bluntly, I am not asking for fixes or updates of previous versions of TShock, but, if I must, I will attempt delve deeper into the understanding of C# to further assist the TShock project and to continue my service with the proper features.

hakusaro commented 8 years ago

screen shot 2016-01-12 at 4 34 31 pm

On the latest stable build, I'm getting the found server issue.

➜  ~  brew upgrade mono
==> Upgrading 1 outdated package, with result:
mono 4.2.1.102_1
==> Upgrading mono
==> Downloading https://homebrew.bintray.com/bottles/mono-4.2.1.102_1.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mono-4.2.1.102_1.el_capitan.bottle.tar.gz
==> Caveats
To use the assemblies from other formulae you need to set:
  export MONO_GAC_PREFIX="/usr/local"
Note that the 'mono' formula now includes F#. If you have
the 'fsharp' formula installed, remove it with 'brew uninstall fsharp'.
==> Summary
🍺  /usr/local/Cellar/mono/4.2.1.102_1: 1,079 files, 205M
➜  ~  mono --version
Mono JIT compiler version 4.2.1 (Stable 4.2.1.102/6dd2d0d Wed Dec  2 14:02:18 PST 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug
    LLVM:          supported, not enabled.
    GC:            sgen

If I disconnect and reconnect, the dead connection still lives on the server (the slot count increments by one each time).

hakusaro commented 8 years ago

cc @tylerjwatson

QuiCM commented 8 years ago

terraria Mono JIT compiler version 4.2.1 (Stable 4.2.1.102/6dd2d0d Thu Nov 12 09:52:44 UTC 2015) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: __thread SIGSEGV: altstack Notifications: epoll Architecture: amd64 Disabled: none Misc: softdebug LLVM: supported, not enabled. GC: sgen

(Ubuntu 14.04)

hakusaro commented 8 years ago

@WhiteXZ maybe this means the problem has something to do with the runtime settings?

E.g. TLS/etc?

tylerjwatson commented 8 years ago

Last night I got up to running it on a small el6 vm but didn't quite finish.

@nicatronTg, run with --debug --trace E:all?

tylerjwatson commented 8 years ago

If it's reproducible on mac then that helps me out rather than me installing random distros

tylerjwatson commented 8 years ago

Notes:

  1. Test whether half-open or lingering sockets (such as connections made from nc) interrupt the packet queue for everyone else
  2. Test whether connections fail if the first message is exchanged before the send thread starts, and test if this causes queued items to fail. perhaps put an async delay in for 1 second to simulate a slow new?
  3. Test whether the first message is exchanged before a SendQueue is newed up for the remote client
  4. Watch on Main.clients[].pendingTermination to see if it is getting flipped somewhere where it shouldnt
  5. https://tshock.co/xf/index.php?threads/connecting-stuck-on-found-server.4213/#post-44224
  6. Watch client state == 0 before connecting to a slot. may need to be reset on connection accept if there is crust from another half-open client before it
tylerjwatson commented 8 years ago

Hi guys, please try bamboo build 583 featured here and see if it aleviates the problem.

KingArty commented 8 years ago

Thank you, Testing that build on my headless server has solved my issue. I'll try and install plugins on the server to test the extent of the fix.

tylerjwatson commented 8 years ago

It looks like bamboo build 583 fixes the problem. As there are multiple problems here and this issue has become quite messy, please open a new issue if it persists.

QuiCM commented 8 years ago

As a quick update to this, 583 introduced an issue where tiles would not load. This issue is fixed in 585, please use 585 instead :)