[jboss-jira] [JBoss JIRA] (JGRP-2263) GRAVE: JGRP000225: failed unmarshalling buffer into return value

Bela Ban (JIRA) issues at jboss.org
Tue Apr 24 05:40:00 EDT 2018


     [ https://issues.jboss.org/browse/JGRP-2263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bela Ban updated JGRP-2263:
---------------------------
         Fix Version/s: 4.0.12
    Steps to Reproduce: 

public class SimpleChat {
    JChannel channel;
    RpcDispatcher dispatcher;

    private static final RequestOptions IMPORTANT = new RequestOptions(ResponseMode.GET_ALL, TimeUnit.SECONDS.toMillis(60)).setFlags(Message.Flag.DONT_BUNDLE);

    private void start() throws Exception {

        channel = new JChannel();

        dispatcher = new RpcDispatcher(channel, new Test() {

        });

        channel.connect("ChatCluster");
        channel.getState(null, 10000);

        Method test = Test.class.getMethod("test");

        Object o = dispatcher.callRemoteMethods(null, new MethodCall(test), IMPORTANT);
        System.out.println(o);

        channel.close();
    }


    public static void main(String[] args) throws Exception {
        new SimpleChat().start();
    }


    public static class Test {
        public Object test() {
            return new EError(EError.EErrorKind.WRONG_PARAMS);
        }
    }

    public static class EError extends Error {
        private static final long serialVersionUID = 1L;

        enum EErrorKind {
            WRONG_PARAMS,
        }

        final EErrorKind code;

        public EError(EError.EErrorKind code) {
            this.code = code;
        }
    }
}



  was:


public class SimpleChat {
    JChannel channel;
    RpcDispatcher dispatcher;

    private static final RequestOptions IMPORTANT = new RequestOptions(ResponseMode.GET_ALL, TimeUnit.SECONDS.toMillis(60)).setFlags(Message.Flag.DONT_BUNDLE);

    private void start() throws Exception {

        channel = new JChannel();

        dispatcher = new RpcDispatcher(channel, new Test() {

        });

        channel.connect("ChatCluster");
        channel.getState(null, 10000);

        Method test = Test.class.getMethod("test");

        Object o = dispatcher.callRemoteMethods(null, new MethodCall(test), IMPORTANT);
        System.out.println(o);

        channel.close();
    }


    public static void main(String[] args) throws Exception {
        new SimpleChat().start();
    }


    public static class Test {
        public Object test() {
            return new EError(EError.EErrorKind.WRONG_PARAMS);
        }
    }

    public static class EError extends Error {
        private static final long serialVersionUID = 1L;

        enum EErrorKind {
            WRONG_PARAMS,
        }

        final EErrorKind code;

        public EError(EError.EErrorKind code) {
            this.code = code;
        }
    }
}





OK, so the problem is that exceptions were marshalled/unmarshalled as a special case, and the marshalling included only the stack trace and error message.
This was done to improve performance of RPCs. However, as exceptions are not thrown frequently, I'll remove the TYPE_EXCEPTION type again and marshall exceptions as Serializable.

> GRAVE: JGRP000225: failed unmarshalling buffer into return value
> ----------------------------------------------------------------
>
>                 Key: JGRP-2263
>                 URL: https://issues.jboss.org/browse/JGRP-2263
>             Project: JGroups
>          Issue Type: Bug
>    Affects Versions: 4.0.11
>         Environment: jdk1.8.0_66.jdk
> osx 10.10 & ubuntu 17.10
>            Reporter: rama rama
>            Assignee: Bela Ban
>             Fix For: 4.0.12
>
>         Attachments: SimpleChat.java
>
>
> trying to send a class that previous work with 3.x return 
> "failed unmarshalling buffer into return value"
> jgroups instance it's configured with the default settings
> i create a test case to reproduce it, executing this class on my 2 boxes return
> ----
> GRAVE: JGRP000225: failed unmarshalling buffer into return value
> java.lang.InstantiationException: com.eg.util.comm.SimpleChat$EError
> 	at java.lang.Class.newInstance(Class.java:427)
> 	at org.jgroups.util.Util.readException(Util.java:899)
> 	at org.jgroups.util.Util.exceptionFromStream(Util.java:843)
> 	at org.jgroups.util.Util.exceptionFromStream(Util.java:831)
> 	at org.jgroups.util.Util.objectFromStream(Util.java:782)
> 	at org.jgroups.util.Util.objectFromStream(Util.java:742)
> 	at org.jgroups.blocks.RequestCorrelator.replyFromBuffer(RequestCorrelator.java:463)
> 	at org.jgroups.blocks.RequestCorrelator.handleResponse(RequestCorrelator.java:408)
> 	at org.jgroups.blocks.RequestCorrelator.dispatch(RequestCorrelator.java:363)
> 	at org.jgroups.blocks.RequestCorrelator.receiveMessageBatch(RequestCorrelator.java:326)
> 	at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.up(MessageDispatcher.java:589)
> 	at org.jgroups.JChannel.up(JChannel.java:837)
> 	at org.jgroups.stack.ProtocolStack.up(ProtocolStack.java:896)
> 	at org.jgroups.stack.Protocol.up(Protocol.java:372)
> 	at org.jgroups.protocols.RSVP.up(RSVP.java:233)
> 	at org.jgroups.protocols.FRAG2.up(FRAG2.java:196)
> 	at org.jgroups.protocols.FlowControl.up(FlowControl.java:416)
> 	at org.jgroups.protocols.FlowControl.up(FlowControl.java:416)
> 	at org.jgroups.stack.Protocol.up(Protocol.java:372)
> 	at org.jgroups.protocols.pbcast.STABLE.up(STABLE.java:293)
> 	at org.jgroups.protocols.UNICAST3.deliverBatch(UNICAST3.java:1024)
> 	at org.jgroups.protocols.UNICAST3.removeAndDeliver(UNICAST3.java:833)
> 	at org.jgroups.protocols.UNICAST3.handleBatchFromSelf(UNICAST3.java:520)
> 	at org.jgroups.protocols.UNICAST3.up(UNICAST3.java:435)
> 	at org.jgroups.protocols.pbcast.NAKACK2.up(NAKACK2.java:697)
> 	at org.jgroups.protocols.BARRIER.up(BARRIER.java:195)
> 	at org.jgroups.stack.Protocol.up(Protocol.java:372)
> 	at org.jgroups.protocols.FD_ALL.up(FD_ALL.java:212)
> 	at org.jgroups.stack.Protocol.up(Protocol.java:372)
> 	at org.jgroups.stack.Protocol.up(Protocol.java:372)
> 	at org.jgroups.stack.Protocol.up(Protocol.java:372)
> 	at org.jgroups.protocols.TP.passBatchUp(TP.java:1274)
> 	at org.jgroups.util.MaxOneThreadPerSender$BatchHandlerLoop.passBatchUp(MaxOneThreadPerSender.java:284)
> 	at org.jgroups.util.SubmitToThreadPool$BatchHandler.run(SubmitToThreadPool.java:136)
> 	at org.jgroups.util.MaxOneThreadPerSender$BatchHandlerLoop.run(MaxOneThreadPerSender.java:273)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 	at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.NoSuchMethodException: com.eg.util.comm.SimpleChat$EError.<init>()
> 	at java.lang.Class.getConstructor0(Class.java:3082)
> 	at java.lang.Class.newInstance(Class.java:412)
> 	... 37 more
> -----



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list