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

StackOverFlowException #1813

Closed Patrikkk closed 4 years ago

Patrikkk commented 4 years ago

Reproduction steps (if applicable)?

No info

Any stack traces or error messages (if known)?

[05/19/20 14:11:20] [Server API] Warning: Plugin "TShock" has had an unhandled exception thrown by one of its GameUpdate handlers: 
System.IO.IOException: Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
   at System.Net.Sockets.Socket.BeginSend(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)
   at System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
   at TShockAPI.Sockets.LinuxTcpSocket.Terraria.Net.Sockets.ISocket.AsyncSend(Byte[] data, Int32 offset, Int32 size, SocketSendCallback callback, Object state)
   at TShockAPI.TSPlayer.SendRawData(Byte[] data)
   at TShockAPI.TSPlayer.Spawn(Int32 tilex, Int32 tiley)
   at TShockAPI.TSPlayer.Spawn()
   at TShockAPI.TShock.OnSecondUpdate()
   at TShockAPI.TShock.OnUpdate(EventArgs args)
   at TerrariaApi.Server.HandlerCollection`1.Invoke(ArgsType args)

Any screenshots?

Console

Any log messages from files that end in .log or .txt?

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

AxeelAnder commented 4 years ago

I think this issue should be removed from 1.4.x project. It lacks critical information or even any clues can help us. I firmly believe this issue will never get solved

AxeelAnder commented 4 years ago

Btw I think the exception on console has no relevance to stack overflow. And I know there's many hidden or known bugs may cause stack overflow exception in terraria's worldgen code, it's very likely not a tshock bug.

Patrikkk commented 4 years ago

It has not occurred ever since. So It was either fixed by #1812 , or it was a vanilla code overflow. I'll close it for now. Thanks for the feedback!

ReDuzed commented 4 years ago

TL;DR Error solution

I fell into the trap of using base.Dispose(disposing) at the end of the Dispose() method like I've been doing for quite some time. For this case is wasn't doing me any favors.


1.4.0.4 Pre 8

This is occurring upon server closure. There is a specific plugin that is causing this error, and I bring this up simply because the error eludes me. All hooks aren't doing functions between server start and close, and the rest of the active methods are based on Chat Commands.

img

I stripped it down to just this, and it still returns the StackOverFlowException with it loaded. Without it the server will close without error.

namespace ItemClasses
{
    [ApiVersion(2,1)]
    public class Plugin : TerrariaPlugin
    {
        public override string Name
        {
            get { return "Item Classes"; }
        }
        public override Version Version
        {
            get { return new Version(2, 0, 0, 0); }
        }
        public override string Author
        {
            get { return "Duze"; }
        }
        public override string Description
        {
            get { return "Players can choose between any number of predefined classes."; }
        }
        public Plugin(Main game) : base(game)
        {

        }
        public override void Initialize()
        {

        }
         protected override void Dispose(bool disposing)
        {
            if (disposing)
            {

            }
            base.Dispose();
        }
    }
}