microsoft / AMBROSIA

Robust Distributed Programming Made Easy and Efficient

Home Page:https://microsoft.github.io/AMBROSIA/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

System.Exception: 'Illegal leading byte in message: 51'

lovettchris opened this issue · comments

Somehow my client is getting out of sync on the stream with the ImmortalCoordinator.

In debugging I find this code in Importal.cs:

int commitID = this._ambrosiaReceiveFromStream.ReadIntFixed();
bytesToRead = this._ambrosiaReceiveFromStream.ReadIntFixed();
long checkBytes = this._ambrosiaReceiveFromStream.ReadLongFixed();
long writeSeqID = this._ambrosiaReceiveFromStream.ReadLongFixed();

matches this code in ImmortalCoordinator.Committer.Commit:

_workStream.Write(buf, 0, length);

When I check the stream they are both using the same socket (inverse) port numbers for LocalPort and RemotePort so I'm sure this is the same socket, and when I step over the _workStream.Write call the commitID arrives in my client app. But a weird thing then happens, the bytesToRead seems to skip ahead 4 bytes missing the actual bytesToRead and throwing the stream out of sync resulting in reaching the error case:

var s = String.Format("Illegal leading byte in message: {0}", firstByte);

I have no idea why this is happening, very reproducible. But just once today, it didn't happen and my client/server were working perfectly. Also this is all running on localhost, same box, so unlikely to be network weirdness. Also the HelloWorld app works perfectly every time. Any ideas?

Found the problem. I was building ambrosia latest bits locally, but every time I 'regenerated' my immportals_Generated project, the code generator was moving that library back to Nuget package 1.0.8 which is not compatible.