Skip to content

Kryo serializer crashes on SPARC architectures #3

Description

@PatFin

I have encountered a problem with the apgas library when running on SPARC architecture. The problem is that the calls made by the library to Kryo rely on Sun.misc.Unsafe. This is fine on x86 but crashes on SPARC architectures.

It is a known issue with the Kryo library and can easily be solved : EsotericSoftware/kryo#219 (comment)

In file apgas/apgas/src/apgas/impl/KryoSerializer.java

@Override
  public void write(ObjectDataOutput objectDataOutput, Object object)
      throws IOException {
    final Output output = new UnsafeOutput((OutputStream) objectDataOutput);
    final Kryo kryo = kryoThreadLocal.get();
    kryo.writeClassAndObject(output, object);
    output.flush();
  }

  @Override
  public Object read(ObjectDataInput objectDataInput) throws IOException {
    final Input input = new UnsafeInput((InputStream) objectDataInput);
    final Kryo kryo = kryoThreadLocal.get();
    return kryo.readClassAndObject(input);
  }

Replacing UnsafeOutput by Output and UnsafeInput by Input will prevent the crash from happening.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions