[jboss-jira] [JBoss JIRA] (JGRP-2356) RpcDispatcher#callRemoteMethods does not work while calling MembershipListener#viewAccepted when using ForkChannel.

Bela Ban (Jira) issues at jboss.org
Fri Aug 2 10:18:00 EDT 2019


    [ https://issues.jboss.org/browse/JGRP-2356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13766527#comment-13766527 ] 

Bela Ban commented on JGRP-2356:
--------------------------------

OK, so what you're trying to do is bad and is not guaranteed to work (see below for an explanation)!

It works if you run the code in {{viewAccepted()}} in a separate thread (see below), but that's bad, too!

{code:java}
public void viewAccepted(final View new_view) {
        Runnable view_handler=() -> {
            System.out.println("viewAccepted:start");
            try {
                MethodCall call=new MethodCall(Boe1.class.getMethod("boeee"));
                RequestOptions options=new RequestOptions(ResponseMode.GET_ALL, 0, true, null)
                  .setFlags(Message.Flag.OOB);
                dispatcher1.callRemoteMethods(null, call, options);
            }
            catch(final Exception e) {
                e.printStackTrace();
            }
            System.out.println("viewAccepted:end");
        };
        new Thread(view_handler).start(); // run in the background
    }
{code}

OK, so here's the real issue: when you have view \{A,B\}, and C joins, then the following can happen:
* At time T0, A and B install new view \{A,B,C\}
* At time T50, C installs the new view, too
* If A and B invoke a blocking RPC (on A, B and C) *before T50 has been reached*, C will drop the RPC, because it is not yet member of the group!
* This means that A and B will block, possibly forever (depending on the RPC's RequestOptions), until C's response has been received.

Also, as I said before, invoking an RPC in {{viewAccepted()}} is bad practice and discouraged!

> RpcDispatcher#callRemoteMethods does not work while calling MembershipListener#viewAccepted when using ForkChannel.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: JGRP-2356
>                 URL: https://issues.jboss.org/browse/JGRP-2356
>             Project: JGroups
>          Issue Type: Bug
>    Affects Versions: 4.1.0
>         Environment: Java: jdk1.8.0_212
> OS: Windows 7 / Linux(ubuntu)
>            Reporter: Ziro Tanaka
>            Assignee: Bela Ban
>            Priority: Major
>             Fix For: 4.1.3
>
>         Attachments: JChannelRunner.java, coordinator_log.txt, coordinator_threaddump.txt, joinner_log.txt
>
>
> Create RpcDispatcher that works with ForkChannel and set MembershipListener.
> If you make a synchronous call with RpcDispatcher in MembershipListener#viewAccepted, no response will be returned.



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list