Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kryo serializer crashes on SPARC architectures #3

Open
PatFin opened this issue Jan 29, 2019 · 0 comments
Open

Kryo serializer crashes on SPARC architectures #3

PatFin opened this issue Jan 29, 2019 · 0 comments

Comments

@PatFin
Copy link

PatFin commented Jan 29, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant