SpaceManiac / Spacecraft

Spacecraft is the SpaceManiac Minecraft Server, a C# server for Minecraft (http://minecraft.net) licensed under CC-BY-SA
3 stars 1 forks source link

Crash during Heartbeat #1

Closed AtkinsSJ closed 14 years ago

AtkinsSJ commented 14 years ago

I noticed you'd crashed my server, or it had crashed while you two were on it anyway. :P Here's the error message I got:

Unhandled Exception: System.Net.WebException: Error getting response stream (ReadDone1): ReceiveFailure ---> System.IO.IOException: EndRead failure ---> System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket+SocketAsyncResult.CheckIfThrowDelayedException () [0x00000] 
  at System.Net.Sockets.Socket.EndReceive (IAsyncResult asyncResult, System.Net.Sockets.SocketError& errorCode) [0x00000] 
  at System.Net.Sockets.Socket.EndReceive (IAsyncResult result) [0x00000] 
  at System.Net.Sockets.NetworkStream.EndRead (IAsyncResult ar) [0x00000] 
  --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.EndRead (IAsyncResult ar) [0x00000] 
  at System.Net.WebConnection.ReadDone (IAsyncResult result) [0x00000] 
  --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] 
  at System.Net.HttpWebRequest.GetResponse () [0x00000] 
  at spacecraft.Server.Heartbeat () [0x00000] 
  at spacecraft.Server.TimerThread () [0x00000] 
AtkinsSJ commented 14 years ago

OK, got it a second time. Any ideas why?

SpaceManiac commented 14 years ago

As far as I can tell, something went wrong during the heartbeat to minecraft.net and Spacecraft doesn't catch it yet. I'll be sure to add more graceful handling of heartbeat errors.

In this case, the end error is "Connection reset by peer," which effectively means that minecraft.net hung up on Spacecraft during the heartbeat.

Thanks for reminding me of another important place we need proper error handling :P

SpaceManiac commented 14 years ago

Oh, it happened a second time. Hmm. Maybe make sure your computer can properly connect to Minecraft.net? Not sure what the underlying issue of this problem is, but it must be something on your side.

Like I said, I'll be sure to add graceful error handling in the event of a failed heartbeat.

AtkinsSJ commented 14 years ago

I can connect, but I guess the connection isn't consistent enough. It's crashed a third time so it needs fixing! :P

SpaceManiac commented 14 years ago

As of revision 3e57440ec947c7bb89d48ed11c34eb91526f3249, Server.Heartbeat will catch a WebException such as the one thrown and print an error message rather than crashing. Issue closed, for now.