Archived

This forum has been archived. Please start a new discussion on GitHub.

UnmarshalOutOfBoundsException when sending byte sequences

I'm using Ice 2.1.0 on SunOS. I have an application where the client and server will be exchanging sequences of bytes. Both client and server are being built from the same Slice defintion.

My client code:
//// A proxy to the server, sg, and the ByteSeq, bs, are both being created successfully ////
// Set the new geometry
sg->setGeometry(bs);
cout << "Set geometry (" << bs.size() << " bytes) for segment " << name << endl;

My server code:
virtual void setGeometry(const ByteSeq &geom,const Ice::Current &)
{
    cout << "Setting geometry, size " << geom.size() << " bytes" << endl;
    geometry = geom;
}

The relevent Slice code:
sequence<byte> ByteSeq;
...
interface SegmentI {
    ...
    void setGeometry(ByteSeq geom);
    ...
};
...
class PersistentPsu implements SegmentI {
    ...
    ByteSeq geometry;
};

When the client runs, it prints its message "Set geometry ......" successfully, but then dies with a Bus Error. The server does not print its message, but dies with the message 'terminate called after throwing an instance of 'Ice::UnmarshalOutOfBoundsException'

Does anyone have any ideas as to what might be causing this?

Comments

  • bernard
    bernard Jupiter, FL
    I don't see anything suspicious in your code fragments. Can you post a simple (and complete) test case that reproduces this crash?

    Thanks,
    Bernard
  • marc
    marc Florida
    The first thing you should check is if your server and client are indeed using the same Slice definitions. In most cases, and UnmarshalOutOfBoundsException is caused by the client and the server using different interface and type definitions.
  • Well, problem solved. The client and server applications were using the same Slice definitions, but our application uses Freeze, and the Berkeley database was initialized by an application with an older version of the Slice file now in use; specifically, the datatypes for the geometry information were different. When the server went to commit the newly updated information to the database, it couldn't be unmarshaled correctly and thus the server threw the exception.

    Thanks for your help on this.