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

Is it acceptable to enable serialization between actors at one local galaxy node? #110

Closed
hsestupin opened this Issue Aug 13, 2015 · 5 comments

Comments

Projects
None yet
3 participants
@hsestupin
Contributor

hsestupin commented Aug 13, 2015

I've created a tiny project to play with - https://github.com/hsestupin/quasar-galaxy-issue
You can get an issue with

    gradle :issue1:run

Expected behaviour is throwing the following exception:
java.lang.ClassCastException: co.paralleluniverse.remote.galaxy.GlxGlobalRegistry$3 cannot be cast to co.paralleluniverse.remote.galaxy.GlobalRemoteChannelReceiver

In our project we use custom high-level protocol for interaction between actors which is implemented with simple actor-message passing underneath. Our protocol assumes that serialization is always enabled. And one of the messages contains ActorRef, and this forces actor to be serialized on one local galaxy node.

So the question is should we support the case of local actors interaction or is this a quasar/galaxy issue? Thanks

@pron

This comment has been minimized.

Show comment
Hide comment
@pron

pron Aug 13, 2015

Member

Have you traced the cause of this problem?
As to your general question, actor serialization is perhaps too automatic, and might justify a more fine-grained API. Can you explain your use case and why you'd want serialization within a single JVM?

Member

pron commented Aug 13, 2015

Have you traced the cause of this problem?
As to your general question, actor serialization is perhaps too automatic, and might justify a more fine-grained API. Can you explain your use case and why you'd want serialization within a single JVM?

@st0nx

This comment has been minimized.

Show comment
Hide comment
@st0nx

st0nx Aug 14, 2015

Grid.getInstance("\\config\\peerNoServer.xml", "\\config\\peer1.properties").goOnline();
    ActorServer actorServer = new ActorServer();
    ActorClient client = new ActorClient();
    client.spawn();
    client.register("client");
    actorServer.spawn();
    actorServer.register("server");
    ActorRegistry.getActor("server");
    final ActorRef<Object> clientGlobal = ActorRegistry.getActor("client");
    final Behavior refLocal = actorServer.ref();
    clientGlobal.send(refLocal);

When there is a call ActorRegistry.getActor ("server"), in co.paralleluniverse.remote.galaxy.GlxGlobalRegistry#getActor0 exhibited AbstractCacheListener, but when I send clientGlobal.send (refLocal), the object is serialized and Kryo serialization is co.paralleluniverse.io. serialization.kryo.ReplaceableObjectKryo#writeObject which call Actor writeReplace, which creates co.paralleluniverse.remote.galaxy.GlxGlobalRemoteActor and call in construct co.paralleluniverse.remote.galaxy.GlobalRemoteChannelReceiver#getReceiver, as was previously exhibited AbstractCacheListener we get ClassCastExeption.

st0nx commented Aug 14, 2015

Grid.getInstance("\\config\\peerNoServer.xml", "\\config\\peer1.properties").goOnline();
    ActorServer actorServer = new ActorServer();
    ActorClient client = new ActorClient();
    client.spawn();
    client.register("client");
    actorServer.spawn();
    actorServer.register("server");
    ActorRegistry.getActor("server");
    final ActorRef<Object> clientGlobal = ActorRegistry.getActor("client");
    final Behavior refLocal = actorServer.ref();
    clientGlobal.send(refLocal);

When there is a call ActorRegistry.getActor ("server"), in co.paralleluniverse.remote.galaxy.GlxGlobalRegistry#getActor0 exhibited AbstractCacheListener, but when I send clientGlobal.send (refLocal), the object is serialized and Kryo serialization is co.paralleluniverse.io. serialization.kryo.ReplaceableObjectKryo#writeObject which call Actor writeReplace, which creates co.paralleluniverse.remote.galaxy.GlxGlobalRemoteActor and call in construct co.paralleluniverse.remote.galaxy.GlobalRemoteChannelReceiver#getReceiver, as was previously exhibited AbstractCacheListener we get ClassCastExeption.

@hsestupin

This comment has been minimized.

Show comment
Hide comment
@hsestupin

hsestupin Aug 14, 2015

Contributor

Ok, I tried to simplify my example as much as possible. https://github.com/hsestupin/quasar-galaxy-issue

So I've initialized FlightRecorder and we can see what happens. You can run example the same way:

gradle :issue1:run

The code in Example1 class do the following:

  • create MyActor and spawns it
  • register actor in GalaxyGlobalActorRegistry
  • get global ref by co.paralleluniverse.actors.ActorRegistry#getActor(java.lang.String)
  • send local ref of actor to the his global ref

Actually I don't think the use-case described above is somehow undesirable for quasar-actor system, doesn't it? It seems like its pretty ok to pass actor-refs to each other.

Contributor

hsestupin commented Aug 14, 2015

Ok, I tried to simplify my example as much as possible. https://github.com/hsestupin/quasar-galaxy-issue

So I've initialized FlightRecorder and we can see what happens. You can run example the same way:

gradle :issue1:run

The code in Example1 class do the following:

  • create MyActor and spawns it
  • register actor in GalaxyGlobalActorRegistry
  • get global ref by co.paralleluniverse.actors.ActorRegistry#getActor(java.lang.String)
  • send local ref of actor to the his global ref

Actually I don't think the use-case described above is somehow undesirable for quasar-actor system, doesn't it? It seems like its pretty ok to pass actor-refs to each other.

@pron pron self-assigned this Aug 17, 2015

@pron pron added the bug label Aug 17, 2015

@pron

This comment has been minimized.

Show comment
Hide comment
@pron

pron Aug 21, 2015

Member

Working on it...

Member

pron commented Aug 21, 2015

Working on it...

@hsestupin

This comment has been minimized.

Show comment
Hide comment
@hsestupin

hsestupin Aug 26, 2015

Contributor

Awesome, thanks

Contributor

hsestupin commented Aug 26, 2015

Awesome, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment