Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-11664

EJB client 4 is unable to discover EJB after WildFly crash during previous call and reboot

    XMLWordPrintable

Details

    • Bug
    • Resolution: Obsolete
    • Blocker
    • None
    • 14.0.0.Final, 15.0.0.Final
    • EJB, Remoting
    • None
    • Hide
      1. Download & unzip reproducer (there are client and server side app, byteman script is in the client folder)
      2. unzip 2x WildFly distribution
      3. build server
      4. deploy server-side app as server-1.jar to the first server and run:
        export JAVA_OPTS="-Djboss.modules.system.pkgs=path-to-byteman.jar=script:path-to-HelloBeanCrash.btm"
        ./bin/standalone.sh -c standalone-full.xml
        
      5. deploy server-side app as server-2.jar to the second server and run:
        ./bin/standalone.sh -c standalone-full.xml -Djboss.socket.binding.port-offset=100
        
      6. run client-side app side
        mvn package exec:exec
        
      7. during countdown (you have 30 seconds) run on the first:
        unset JAVA_OPTS
        ./bin/standalone.sh -c standalone-full.xml
        
      Show
      Download & unzip reproducer (there are client and server side app, byteman script is in the client folder) unzip 2x WildFly distribution build server deploy server-side app as server-1.jar to the first server and run: export JAVA_OPTS= "-Djboss.modules.system.pkgs=path-to-byteman.jar=script:path-to-HelloBeanCrash.btm" ./bin/standalone.sh -c standalone-full.xml deploy server-side app as server-2.jar to the second server and run: ./bin/standalone.sh -c standalone-full.xml -Djboss.socket.binding.port-offset=100 run client-side app side mvn package exec:exec during countdown (you have 30 seconds) run on the first: unset JAVA_OPTS ./bin/standalone.sh -c standalone-full.xml

    Description

      Issue is not valid for 7.2.0.CD12 (upstream client: 12.0.0.Final) therefore we consider this as a blocker.

      Lets have two WildFly servers and same EJB on both. They have nothing to do with each other. And the client app that call beans on them.

      Scenario

      1. Client invokes hello method on the first server which crash during the call. Exception is consumed.
      2. Client calls successfully hello method on the second one.
      3. Now, the first server is started again and then the client (same thread) try to call hello on the first one. The call should be successful but the client is unable to discover bean.
      Exception in thread "main" java.lang.RuntimeException: javax.ejb.NoSuchEJBException: EJBCLIENT000079: Unable to discover destination for request for EJB StatelessEJBLocator for "/server-1/HelloBean", view is interface ejb.HelloBeanRemote, affinity is None
              at client.Client.call(Client.java:41)
              at client.Client.main(Client.java:21)
      Caused by: javax.ejb.NoSuchEJBException: EJBCLIENT000079: Unable to discover destination for request for EJB StatelessEJBLocator for "/server-1/HelloBean", view is interface ejb.HelloBeanRemote, affinity is None
              at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:592)
              at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
              at org.jboss.ejb.protocol.remote.RemotingEJBClientInterceptor.handleInvocationResult(RemotingEJBClientInterceptor.java:56)
              at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:594)
              at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
              at org.jboss.ejb.client.TransactionPostDiscoveryInterceptor.handleInvocationResult(TransactionPostDiscoveryInterceptor.java:133)
              at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:594)
              at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
              at org.jboss.ejb.client.DiscoveryEJBClientInterceptor.handleInvocationResult(DiscoveryEJBClientInterceptor.java:115)
              at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:594)
              at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
              at org.jboss.ejb.client.NamingEJBClientInterceptor.handleInvocationResult(NamingEJBClientInterceptor.java:79)
              at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:594)
              at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
              at org.jboss.ejb.client.TransactionInterceptor.handleInvocationResult(TransactionInterceptor.java:172)
              at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:594)
              at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:528)
              at org.jboss.ejb.client.EJBClientInvocationContext.awaitResponse(EJBClientInvocationContext.java:938)
              at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:177)
              at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:112)
              at com.sun.proxy.$Proxy0.hello(Unknown Source)
              at client.Client.call(Client.java:35)
              ... 1 more
      

      I hit this issue with 15.0.0.Final, 14.0.0.Final but not with 12.0.0.Final.
      If client try to invoke hello on the first server before it reboots (exception is consumed), there is no problem after.

      Client side

          public static void main(String[] args)
                  throws Exception {
              call("server-2", true);
              call("server-1", true);
      
              for (int i = 30; i > 0; i--) {
                  System.out.println(i);
                  Thread.sleep(1000);
              }
              call("server-1", false);
          }
      
          public static Properties getCtxProperties() {
              Properties props = new Properties();
              props.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
              return props;
          }
      
          public static void call(String container, boolean exceptedFailure) {
              try {
                  InitialContext ctx = new InitialContext(getCtxProperties());
                  String lookupName = "ejb:/" + container + "/HelloBean!ejb.HelloBeanRemote";
                  HelloBeanRemote bean = (HelloBeanRemote) ctx.lookup(lookupName);
                  System.out.println(bean.hello());
              } catch (Exception e) {
                  if (exceptedFailure) {
                      System.out.println("EXPECTED FAILURE");
                      e.printStackTrace();
                  } else {
                      throw new RuntimeException(e);
                  }
              }
          }
      

      Server side

      @Stateless
      @Remote(HelloBeanRemote.class)
      public class HelloBean {
          private static Logger log = Logger.getLogger(HelloBean.class);
      
      
          public String hello() throws RemoteException {
              log.info("hello called with message");
              return "Hello there";
          }
      }
      

      Attachments

        Issue Links

          Activity

            People

              flaviarnn Flavia Rainone
              istraka@redhat.com Ivan Straka
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: