Author Topic: Trying to read past the buffer size - likely caused by mismatching Write/Reads  (Read 7843 times)

Offline Spikey00

  • Lord of just 5 Colony Ships
  • Master Member Mark II
  • *****
  • Posts: 1,704
  • And he sayeth to sea worm, thou shalt wriggle
Trying to read past the buffer size - likely caused by mismatching Write/Reads, different size or order.

   at NetBuffer.ReadBytes(Byte[] into, Int32, offset, Int32 numberOfBytes)
   at IncomingNetMessage.ReadFrom(NetBuffer buffer, IPEndPoint endpoint)
   at NetBase.BaseHeartbeat(Double now)
   at Netbase.Run()
   at ThreadHelper.ThreadStart_Context(Object State)
   at ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at ThreadHelper.ThreadStart()

Retry/Ignore/Abort, no logs.

I was hosting to another friend and the game was playing fine (though it was lag spiking a bit; network +/- made little difference), and nothing noticeable happened during the time where I received the dialog.  "Waiting for Players" appeared, and friend could not connect back into game after I "retried" it, and when I restarted the game and save, he still could not.  This occurred early in the game, and reoccurs with another game we tried.

Latest version and expansion.

EDIT:  For more information, since I just realized my post was utter crap (but tight on time at the moment):
- Windows 7 x64 (might be missing something system-wise after my re-install of OS),
- Specs ran fine AI War before, though video card was replaced by a 240GT [but doubt relevant].

Any more information needed, please ask.
« Last Edit: April 01, 2010, 11:04:53 pm by Spikey00 »
I'd take a sea worm any time over a hundred emotionless spinning carriers.
irc.appliedirc.com / #aiwar
AI War Facebook
AI War Steam Group

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Hmm, this is a new one.  What version of the game were you playing on?  This sort of error would generally happen when some other process injects some data into the stream of data along that port.  If you're playing on a custom port (80 or what have you), and any other traffic is happening along that port, that could be the cause of it.  Basically, that would be data from some other program getting mixed in with the AI War data and causing this.

Beyond that, I'm not sure quite what to tell you.  We switched to the most recent version of the Lidgren Network library a few weeks back, and that seems to have been a positive thing for most folks in beta; if you are on the latest beta, then maybe you've stumbled into some bug with the latest network library that wasn't there before, but given the isolated nature of this I'm suspecting something else is at play.

I am wondering, for instance if there is QoS running on your or your friends' routers.  That tends to wreak all sort of havoc on AI War, given that it has a very uneven volume of data flowing, and QoS tries to "smooth" that out with disastrous results.  That sort of thing can cause lag spikes, as well as permanently dropped packets, and I wouldn't be surprised if it could cause an issue like this, too, though as I say this is a new one on me.

Hope that helps!
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Spikey00

  • Lord of just 5 Colony Ships
  • Master Member Mark II
  • *****
  • Posts: 1,704
  • And he sayeth to sea worm, thou shalt wriggle
Running 3088, ZR, base game to the newest version. 

I assigned 32320 to some other applications, but I don't believe any of those were running in the background, and those were usually other games and such of which I was too lazy to forward other ports for them.  I will have a try at another port for AI War, and I will see if that works when I see my friend.

I forgot to include this in my first post, but I observed an oddity with my side of the game:  ships were appearing to teleport around when they were rallied/moved in a group of ships that reached or stopped at a destination.  They would sometimes 'flash' to another location near the cluster, then 'jump' back in; whether this was caused by the lag or some other element, I don't know, but I never have seen it before.

I will ask my friend about the QoS issue, since my friend is within Canada too, and our connection should be more smooth than that.


Thank you for the reply, Chris.
I'd take a sea worm any time over a hundred emotionless spinning carriers.
irc.appliedirc.com / #aiwar
AI War Facebook
AI War Steam Group

Offline Spikey00

  • Lord of just 5 Colony Ships
  • Master Member Mark II
  • *****
  • Posts: 1,704
  • And he sayeth to sea worm, thou shalt wriggle
Having some technical issues with changing ports and connecting at the moment--we're still trying.

Random crash occurred when creating a lobby [incidentally when creating a game on 32320 before switching to different port] (don't think this is relevant to my problem):

02/04/2010 1:38:00 PM (3.0.8.8)
-----------------------------------Application_ThreadException-----------------------------------System.ComponentModel.Win32Exception: Error creating window handle.
   at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
   at System.Windows.Forms.Control.CreateHandle()
   at System.Windows.Forms.TabControl.CreateHandle()
   at Dotnetrix.Controls.TabControlEX.CreateHandle()
   at System.Windows.Forms.TabControl.GetTabRect(Int32 index)
   at Dotnetrix.Controls.TabControlEX.Draw3DTabs(Graphics graphics, Boolean bevel)
   at Dotnetrix.Controls.TabControlEX.Draw3DTabs(Graphics graphics)
   at Dotnetrix.Controls.TabControlEX.OnPaintBackground(PaintEventArgs pevent)
   at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle, Region transparentRegion)
   at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle, Color backColor, Point scrollOffset)
   at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle)
   at System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent)
   at System.Windows.Forms.ScrollableControl.OnPaintBackground(PaintEventArgs e)
   at System.Windows.Forms.TabPage.OnPaintBackground(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
   at System.Windows.Forms.Control.WmEraseBkgnd(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I'd take a sea worm any time over a hundred emotionless spinning carriers.
irc.appliedirc.com / #aiwar
AI War Facebook
AI War Steam Group

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Hmmm... that is a pretty odd one.  Not sure exactly what would cause that, it might be some missing image or something, that's not an overly descriptive logged error unfortunately.  Though honestly, what that is specifically saying is that your copy of windows evidently ran out of window handles, which... shouldn't happen.  Unless you were running win32, maybe, and had a TON of stuff open at the time.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Spikey00

  • Lord of just 5 Colony Ships
  • Master Member Mark II
  • *****
  • Posts: 1,704
  • And he sayeth to sea worm, thou shalt wriggle
I'm running x64, but I did have a few windows and items open (10?).  It hasn't reoccurred.

It appears that the problem was solved through the changing of the port to another completely free one, and we had a nice game with two other new players.


Thanks for your help, Chris.
I'd take a sea worm any time over a hundred emotionless spinning carriers.
irc.appliedirc.com / #aiwar
AI War Facebook
AI War Steam Group

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
My pleasure -- glad it worked out!
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!