Pryaxis / TShock

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

Your mono runtime and class libraries are out of sync #1451

Closed shuieryin closed 7 years ago

shuieryin commented 7 years ago

Hi there,

I got below errors after installed Tshock 4.3.24 on ubuntu 16.04, Terraria is fresh installed from steam as well. Could you kindly help? Thanks a lot.

Terraria Server v1.3.5.3

Listening on port 7777
Type 'help' for a list of commands.

TShock Notice: authcode.txt is still present, and the AuthToken located in that file will be used.
To become superadmin, join the game and type /auth 5348862
This token will display until disabled by verification. (/auth)
: xxx.xxx.xxx.xxx:56390 is connecting...
cant resolve internal call to "System.Net.Sockets.Socket::Receive_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&)" (tested without signature also)

Your mono runtime and class libraries are out of sync.
The out of sync library is: /root/steamcmd/terraria/System.dll

When you update one from git you need to update, compile and install
the other too.
Do not report this as a bug unless you're sure you have updated correctly:
you probably have a broken mono install.
If you see other errors or faults after this message they are probably related
and you need to fix your mono install first.
cant resolve internal call to "System.Net.Sockets.Socket::Receive_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&)" (tested without signature also)

Your mono runtime and class libraries are out of sync.
The out of sync library is: /root/steamcmd/terraria/System.dll

When you update one from git you need to update, compile and install
the other too.
Do not report this as a bug unless you're sure you have updated correctly:
you probably have a broken mono install.
If you see other errors or faults after this message they are probably related
and you need to fix your mono install first.
aylinni-empyrea commented 7 years ago

steamcmd? What are you running tshock with? mono TerrariaServer.exe?

shuieryin commented 7 years ago

steamcmd is linux version of steam app, i'm running existing world using mono-sgen, everything works fine back in mono version 4.8.1 with tshock beta version 4.3.24, seems the error is caused by upgraded to mono 5.0.0?

cd /root/steamcmd/terraria/
screen -S terraria mono-sgen TerrariaServer.exe -world "/root/.local/share/Terraria/Worlds/Shuieryin.wld"
mistzzt commented 7 years ago

Tested both mono TerrariaServer.exe and mono-sgen TerrariaServer.exe, and I could not reproduce this problem. Here is my mono version, 5.0.0. ver

从这些报错消息来看,似乎是runtime和library版本不符。 尝试重装或更新下mono?(I assume that you're able to read Chinese)

shuieryin commented 7 years ago

@mistzzt 是的能看懂,为了让同样问题又不懂中文的人我还是用回英文 here's my mono version below:

root@terrariatest:~/steamcmd/terraria# mono --version
Mono JIT compiler version 5.0.0 (Stable 5.0.0.100/9667aa6 Thu May 11 14:33:04 UTC 2017)
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 (concurrent by default)

Actually server startup went great, the errors occurs when someone trying to connect to the terraria server.

btw i'm running tr server on ubuntu docker, below quote is running on docker as well

everything works fine back in mono version 4.8.1 with tshock beta version 4.3.24

mistzzt commented 7 years ago

However, I've tried connecting to server, and it works well. Again, according to log message you've posted, try re-install or update mono.

shuieryin commented 7 years ago

@mistzzt i actually re-installed mono whenever i built a new image, and i installed mono by this tutorial http://www.mono-project.com/download/#download-lin, is there anything i missed?

Here's my terraria dockerfile for your reference, the hightlighted part is mono installation. https://github.com/shuieryin/base_dockers/blob/master/dockerfiles/terraria/Dockerfile.formal#L64-L68

hakusaro commented 7 years ago

Sorry, what? Are you using steam and docker at the same time?

hakusaro commented 7 years ago

In general, this is a support issue. I'm going to cautiously leave this open for a little bit longer to get you help, but this should be closed eventually because I don't see a problem with TShock here.

raku-cat commented 4 years ago

I'm running in to this exact same issue, mono-complete is installed, server starts fine, as soon as I try to connect this error shows and I'm never able to actually connect (terraria client just show "Found server" forever). Here's my mono version image I'm running debian unstable/testing, I'm not running terraria in docker in this instance though, just downloaded the server zip from the terraria website. Here's a server log of startup and trying to connect https://gist.github.com/raku-cat/e77bbd0bf1b12e6e2518199f70f46777

hakusaro commented 4 years ago

@raku-cat are you running TShock or vanilla?

raku-cat commented 4 years ago

TShock is what's giving me the issue, vanilla runs fine, the log I included is of me running TShock.

hakusaro commented 4 years ago

@raku-cat aha, I didn't see the gist link the first time (you can thank github mobile beta for that one). The log you included is now reproduced here:

2019-11-18 17:49:49 - TShock: INFO: TShock was improperly shut down. Please use the exit command in the future to prevent this.
2019-11-18 17:49:49 - TextLog: INFO: TShock 4.3.26.0 (Mintaka) now running.
2019-11-18 17:49:49 - TShock: INFO: AutoSave Enabled
2019-11-18 17:49:49 - TShock: INFO: Backups Disabled
2019-11-18 17:49:49 - TShock: INFO: Welcome to TShock for Terraria. Initialization complete.
2019-11-18 17:57:56 - Utils: INFO: Broadcast: Saving world. Momentary lag might result from this.
2019-11-18 17:59:09 - LinuxTcpSocket: ERROR: System.IO.IOException: Unable to read data from the transport connection: Attempted to access a missing method.. ---> System.MissingMethodException: Attempted to access a missing method.
  at System.Net.Sockets.SocketAsyncResult.CheckIfThrowDelayedException () [0x00017] in <6c7c03f48a9747c8a644da4f63a34480>:0 
  at System.Net.Sockets.Socket.EndReceive (System.IAsyncResult asyncResult, System.Net.Sockets.SocketError& errorCode) [0x0003f] in <6c7c03f48a9747c8a644da4f63a34480>:0 
  at System.Net.Sockets.Socket.EndReceive (System.IAsyncResult result) [0x00000] in <6c7c03f48a9747c8a644da4f63a34480>:0 
  at System.Net.Sockets.NetworkStream.EndRead (System.IAsyncResult asyncResult) [0x0005f] in <6c7c03f48a9747c8a644da4f63a34480>:0 
   --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.EndRead (System.IAsyncResult asyncResult) [0x000b1] in <6c7c03f48a9747c8a644da4f63a34480>:0 
  at TShockAPI.Sockets.LinuxTcpSocket.ReadCallback (System.IAsyncResult result) [0x00023] in <ada224128ad446d0bd7a8e65ac0083cb>:0 
2019-11-18 18:01:00 - LinuxTcpSocket: ERROR: System.IO.IOException: Unable to read data from the transport connection: Attempted to access a missing method.. ---> System.MissingMethodException: Attempted to access a missing method.
  at System.Net.Sockets.SocketAsyncResult.CheckIfThrowDelayedException () [0x00017] in <6c7c03f48a9747c8a644da4f63a34480>:0 
  at System.Net.Sockets.Socket.EndReceive (System.IAsyncResult asyncResult, System.Net.Sockets.SocketError& errorCode) [0x0003f] in <6c7c03f48a9747c8a644da4f63a34480>:0 
  at System.Net.Sockets.Socket.EndReceive (System.IAsyncResult result) [0x00000] in <6c7c03f48a9747c8a644da4f63a34480>:0 
  at System.Net.Sockets.NetworkStream.EndRead (System.IAsyncResult asyncResult) [0x0005f] in <6c7c03f48a9747c8a644da4f63a34480>:0 
   --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.EndRead (System.IAsyncResult asyncResult) [0x000b1] in <6c7c03f48a9747c8a644da4f63a34480>:0 
  at TShockAPI.Sockets.LinuxTcpSocket.ReadCallback (System.IAsyncResult result) [0x00023] in <ada224128ad446d0bd7a8e65ac0083cb>:0 

It looks to me like this issue is distinct from the rest of the issues reported in this issue. The original issue includes cant resolve internal call to "System.Net.Sockets.Socket::Receive_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&)" & Your mono runtime and class libraries are out of sync. Yours is a missing method exception, and does not refer to System.Net.Sockets.Socket::Receive_internal, and refers to an issue related to dynamic runtime method calls.

Can you post the directory structure you're running with? In particular, I'm looking for where TerrariaServer.exe is, where OTAPI.dll is, and other related DLLs in relation to the plugins directory. There are also a few other log files usually -- if you can capture those too, that'd be great.

Finally, I assume you downloaded this release? https://github.com/Pryaxis/TShock/releases/tag/v4.3.26. Is that correct?

raku-cat commented 4 years ago

Here's the directory structure, just the Linux dir of the terraria server zip and then TShock unzipped over that image My log does actually have the "Mono runtime and class libraries are out of sync" it just didn't show up in the log file for some reason. I couldn't find any other logs other than the one I uploaded to gist, so I went ahead and just did an asciicast of me starting up the server and trying to connect https://asciinema.org/a/282743

hakusaro commented 4 years ago

You should remove excess DLLs or move TShock's components only to a different folder. You can't have random DLLs inside the same place as the OTAPI-fused Terraria server, or in the ServerPlugins folder. It's likely getting autoloaded because of how mono works. Anything that isn't compatible with our built binaries will likely cause that to happen.

The place where terraria (the game) or official server is installed (such as through steamcmd) is not suitable for TShock. If you want to run TShock, you should have a clean directory and work from there. So mkdir ./tshock/ and move the official release in there. It won't load paths above it but it will load things next to it.

In your recording, you've got:

The out of sync library is: /home/josh/game_servers/terraria/System.dll

System.dll is foreign and doesn't come with TShock at all, but TShock is attempting to load it, because, again, weird mono things and how TShock attempts to make people's lives easier by supporting libraries in random places.

raku-cat commented 4 years ago

Man I feel dumb 🤦 sorry about that, ya it works fine now. I'd say add something to the wiki or somewhere for this specific error but this was probably a matter of me not reading something in the first place so it probably wouldn't help anyone that might run in to this in the future. Thanks for taking the time to help me out with this.

hakusaro commented 4 years ago

@raku-cat we definitely need to add it to readme :)

shuieryin commented 4 years ago

Sorry, what? Are you using steam and docker at the same time?

yes i'm running steamcmd inside docker container with tshcok.. XD

hakusaro commented 4 years ago

Amazing! What did you do to get it working?

shuieryin commented 4 years ago

Amazing! What did you do to get it working?

just wrote a dockerfile based on official ubuntu image and rest is the same as installing Terraria through steamcmd on plain linux, it's convenient for deploying to VPSes or run multiple instances on single VPS or local machine.

hakusaro commented 4 years ago

@shuieryin I'd be interested in your directory structure of the underlying TShock folder, and more specifically, if you're actually running TShock with Steam authentication, if you'd be willing to share. If you have a good Dockerfile, that would also be cool to share if you're willing.

sr229 commented 4 years ago

I did make a Dockerfile that had none of the issues presented here so it might be nice if you can have that.

shuieryin commented 4 years ago

@shuieryin I'd be interested in your directory structure of the underlying TShock folder, and more specifically, if you're actually running TShock with Steam authentication, if you'd be willing to share. If you have a good Dockerfile, that would also be cool to share if you're willing.

I've already removed the Terraria version since I no longer hosting the server, below is the Starbound version with exactly the same steps by installing game body from steamcmd and starrypy (same role as TShock) from host, and the way I saved the storage files is a bit tricky, because I didn't want the storage files saved on host, instead of using -v, I checked them out from svn repository and ran a contab to commit the storage files on a daily basis. I also had a program written by my own to register account through WeChat, you can ignore that one :)

FROM {REGISTRY_HOST}:15000/erlang_ubuntu:latest

MAINTAINER Shuieryin <myea>

LABEL "version"="0.1.0" \
    "description"="starbound game server." \
    "author"="Shuieryin"

WORKDIR /root

ARG LOCAL_PROXY
ENV http_proxy=${LOCAL_PROXY} \
    https_proxy=${LOCAL_PROXY}

# install prereqs & steam
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y lib32gcc1 libvorbisfile3

RUN curl ifconfig.co; echo \
    && mkdir steamcmd
WORKDIR /root/steamcmd
RUN wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz \
    && tar -zxvf steamcmd_linux.tar.gz \
    && rm steamcmd_linux.tar.gz

# install starbound
ARG STEAM_USERNAME
ARG STEAM_PASSWORD
ARG STEAM_GUARD_CODE
RUN echo "#!/bin/bash" | tee update_starbound.sh \
    && echo "./steamcmd.sh +set_steam_guard_code \"${STEAM_GUARD_CODE}\" +login ${STEAM_USERNAME} ${STEAM_PASSWORD} +force_install_dir ./starbound +app_update 211820 +quit" | tee -a update_starbound.sh \
    && chmod +x update_starbound.sh \
    && ./update_starbound.sh

ENV http_proxy="" \
    https_proxy=""

# init existing starbound universe
WORKDIR /root/steamcmd/starbound/
ARG SVN_USERNAME
ARG SVN_PASSWORD
ENV SVN_USERNAME=${SVN_USERNAME} \
    SVN_PASSWORD=${SVN_PASSWORD}
RUN svn --username ${SVN_USERNAME} --password ${SVN_PASSWORD} co svn://{REGISTRY_HOST}:13690/starbound_storage storage

# setup aliases
RUN echo "alias sblog='tail -fn100 /root/steamcmd/starbound/storage/starbound_server.log'" | tee /root/.bash_aliases \
    && echo "alias sbfolder='cd /root/steamcmd/starbound/linux/'" | tee -a /root/.bash_aliases \
    && echo "alias my_ip='curl ifconfig.co'" | tee -a /root/.bash_aliases

# setup crontab script
RUN printenv | sed 's/^\(.*\)$/export \1/g' > /root/project_env.sh \
    && echo "# m h  dom mon dow   command" | tee /var/spool/cron/crontabs/root \
    && echo "  0 5  *   *   *     . /root/project_env.sh; \
     cd /root/steamcmd/starbound/storage; \
     ./svn_backup.sh > /tmp/storage_backup.log &" | tee -a /var/spool/cron/crontabs/root
RUN echo "#!/bin/bash" | tee /root/init_server.sh \
    && echo "initServer()" | tee -a /root/init_server.sh \
    && echo "{" | tee -a /root/init_server.sh \
    && echo "    cron -f > /tmp/cron.log &" | tee -a /root/init_server.sh \
    && echo "    chmod +x /root/project_env.sh" | tee -a /root/init_server.sh \
    && echo "    crontab /var/spool/cron/crontabs/root" | tee -a /root/init_server.sh \
    && echo "    cd /root/steamcmd/starbound/storage" | tee -a /root/init_server.sh \
    && echo "    svn update" | tee -a /root/init_server.sh \
    && echo "    cp sb_server.sh ../linux/sb_server.sh" | tee -a /root/init_server.sh \
    && echo "    cd /root/steamcmd/starbound/linux/" | tee -a /root/init_server.sh \
    && echo "    python3 server.py > starry_log.txt &" | tee -a /root/init_server.sh \
    && echo "}" | tee -a /root/init_server.sh \
    && echo "initServer" | tee -a /root/init_server.sh \
    && chmod +x /root/init_server.sh

RUN cd /root/steamcmd/starbound/storage && svn update \
    && cp sb_server.sh ../linux/sb_server.sh

# grab and build starbound_support
ENV http_proxy=${LOCAL_PROXY} \
    https_proxy=${LOCAL_PROXY}
WORKDIR /root
RUN git config --global http.proxy ${LOCAL_PROXY} \
    && curl ifconfig.co; echo \
    && git clone https://github.com/shuieryin/starbound_support.git
WORKDIR /root/starbound_support
RUN export PATH=$PATH:/opt/erlang/bin \
    && git config --global user.email "myemail" \
    && git config --global user.name "shuieryin" \
    && make

ENV http_proxy="" \
    https_proxy=""

WORKDIR /root/steamcmd/starbound/
ADD starrypy3k starrypy3k
RUN mv starrypy3k/* linux/ && rm -rf starrypy3k

WORKDIR /root/starbound_support
CMD /root/init_server.sh && make run
sr229 commented 4 years ago

MAINTAINER is a deprecated tag according to Docker, you should be using LABEL maintainer by now.

shuieryin commented 4 years ago

MAINTAINER is a deprecated tag according to Docker, you should be using LABEL maintainer by now.

ya the dockfile was written quite some time ago, I updated some of my other dockerfiles but missed this one.. XD