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

Thrown exception upon saving world: System.ArgumentException: is negative #1235

Closed TETYYS closed 8 years ago

TETYYS commented 8 years ago
Saving world data: 97%
Saving world data: 98%
Saving world data: 99%
Saving world data: 100%
Validating world save: 16%
Validating world save: 29%
Validating world save: 45%
Validating world save: 58%
Validating world save: 77%
Validating world save: 88%
World saved.
[Server API] Error ===================================================================================
[Server API] Error An unhandled exception has occured in TSAPI, and a crash report will be generated
[Server API] Error Generating a crash report, please wait...
Validating world save: 100%
[Server API] Error Crash report saved at crash_131119429153073260.zip
[Server API] Error Please upload the crash file and report it at http://tshock.co/
[Server API] Error The process will terminate.
[Server API] Error ===================================================================================
exception inside UnhandledException handler: is negative

[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: is negative
Parameter name: count
  at System.IO.StreamWriter.Write (System.Char[] buffer, Int32 index, Int32 count) <0x7fda9975c370 + 0x002ad> in <filename unknown>:0
  at System.IO.TextWriter.WriteLine (System.String value) <0x7fda99760b90 + 0x00141> in <filename unknown>:0
  at TShockAPI.TextLog.Write (System.String message, TraceLevel level) <0x404ac050 + 0x002c6> in <filename unknown>:0
  at TShockAPI.TextLog.Error (System.String message) <0x40c0b150 + 0x00017> in <filename unknown>:0
  at TShockAPI.SaveManager.SaveWorker () <0x404b4640 + 0x0029b> in <filename unknown>:0
  at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) <0x7fda9983d010 + 0x00099> in <filename unknown>:0
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, Boolean preserveSyncCtx) <0x7fda9983b850 + 0x0016e> in <filename unknown>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, Boolean preserveSyncCtx) <0x7fda9983b820 + 0x00020> in <filename unknown>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) <0x7fda9983b770 + 0x00059> in <filename unknown>:0
  at System.Threading.ThreadHelper.ThreadStart () <0x7fda9983d1d0 + 0x0002e> in <filename unknown>:0
"exception": {
    "message": "is negative\nParameter name: count",
    "type": "ArgumentException",
    "trace": "  at System.IO.StreamWriter.Write (System.Char[] buffer, Int32 index, Int32 count) <0x7fda997$
    "inner": null
  }

Happened when I unexpectedly disconnected, not sure if world was saving at the time I disconnected.

Patrikkk-zz commented 8 years ago

Do you have the crash_131119429153073260.zip? :)

TETYYS commented 8 years ago

Yes, it just contains crash.json:

{
  "os": {
    "x64": "yes",
    "x64Process": "yes",
    "Platform": "Unix",
    "Version": "Unix 4.3.0.1"
  },
  "hardware": {
    "CPUs": 8,
    "CPUID": null
  },
  "server": {
    "Players": 0,
    "MaxPlayers": 255,
    "WorldName": "World",
    "WorldFile": "/home/tetyys/My Games/Terraria/Worlds/World.wld.crash.crash.crash.crash",
    "Time": 11243.0
  },
  "process": {
    "curRelease": 169,
    "TSAPIVersion": "1.3.1.1",
    "Uptime": "4.21:51:25.1564020",
    "WorkingDirectory": "",
    "Arguments": ""
  },
  "memory": [],
  "plugins": [
    {
      "Name": "TShock",
      "Author": "The TShock Team",
      "Version": "4.3.16.0"
    }
  ],
  "exception": {
    "message": "is negative\nParameter name: count",
    "type": "ArgumentException",
    "trace": "  at System.IO.StreamWriter.Write (System.Char[] buffer, Int32 index, Int32 count) <0x7fda9983d1d0 + 0x0002e> in <filename unknown>:0 ",
    "inner": null
  }
}
Patrikkk-zz commented 8 years ago

Oh, I thought it makes a memory dump.
Could have found where the bad data was coming from. Didn't meet with this issue before. Can't think of what the problem could have been. It's clearly coming from TShockAPI.TextLog.Write, most probably line 223.

Do tell if it happens again :)

TETYYS commented 8 years ago

It just saved world fine under normal circumstances. To be more clear, I was fighting one of the Celestial Towers when unexpectedly disconnected on my end, but not sure if world was in progress of saving at the time

hakusaro commented 8 years ago

Memory dumps don't work on unix @Patrikkk (afaik).

I'm closing this but tag me in a comment if this issue ever happens again.