6 Replies Latest reply on Feb 13, 2012 6:07 PM by fvitorc

    Possible RPC bus subscription/unsubscription bug

    fvitorc

      Hi again,

       

      During a normal RPC (setting RemoteCallback and ErrorCallback), errai sends a RemoteSubscribe to the ServerBus with the following subjects:

      {className}:RPC.{methodName}:{parameterClassNames}::Errors:{sequential}

      {className}:RPC.{methodName}:{parameterClassNames}::RespondTo:{sequential}

       

      After the RPC has completed, the RemoteCallback or the ErrorCallback is invoked on the client side.

      I expected that the correct behaviour after that would be to unsubscribe both of these subjects.

       

      Instead, if the ErrorCallback is invoked, only the subject {className}:RPC.{methodName}:{parameterClassNames}::Errors:{sequential} is unsubscribed.

      And if RemoteCallback is invoked, only the subject {className}:RPC.{methodName}:{parameterClassNames}::RespondTo:{sequential} is unsubscribed.

       

      Either way, one of them would be still active. That could become a performance issue if there are many RPCs going on for a long period.

      Besides that, the sequential is reused (it goes back to 1), and maybe there would be two subscriptions to the same RPC subject at a given time.

       

      Regards,

      Vitor.

        • 1. Re: Possible RPC bus subscription/unsubscription bug
          csa

          Yes, that's a bug. It's fixed now in the latest 2.0-SNAPSHOT (should be published within the next hour or so). Thanks for reporting this!

           

          Cheers,

          Christian

          • 2. Re: Possible RPC bus subscription/unsubscription bug
            fvitorc

            Hi, I've been trying to check if this bug has been fixed, but I cannot gwt-compile my project with 2.0-SNAPSHOT.

            I get the following error:

             

            INFO [RpcProxyLoaderGenerator] nothing has changed. using cached rpc proxy loader class.

               [ERROR] An internal compiler exception occurred

            com.google.gwt.dev.jjs.InternalCompilerException: Failed to get JNode

                      at com.google.gwt.dev.jjs.impl.TypeMap.get(TypeMap.java:140)

                      at com.google.gwt.dev.jjs.impl.TypeMap.get(TypeMap.java:71)

                      at com.google.gwt.dev.jjs.impl.BuildTypeMap.getType(BuildTypeMap.java:730)

                      at com.google.gwt.dev.jjs.impl.BuildTypeMap.processMethodBinding(BuildTypeMap.java:951)

                      at com.google.gwt.dev.jjs.impl.BuildTypeMap.access$400(BuildTypeMap.java:99)

                      at com.google.gwt.dev.jjs.impl.BuildTypeMap$BuildDeclMapVisitor.visit(BuildTypeMap.java:222)

                      at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:209)

                      at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1294)

                      at org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.traverse(QualifiedAllocationExpression.java:478)

                      at org.eclipse.jdt.internal.compiler.ast.Assignment.traverse(Assignment.java:255)

                      at org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.traverse(ConstructorDeclaration.java:505)

                      at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1239)

                      at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:687)

                      at com.google.gwt.dev.jjs.impl.BuildTypeMap.createPeersForNonTypeDecls(BuildTypeMap.java:637)

                      at com.google.gwt.dev.jjs.impl.BuildTypeMap.exec(BuildTypeMap.java:514)

                      at com.google.gwt.dev.jjs.impl.BuildTypeMap.exec(BuildTypeMap.java:523)

                      at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:599)

                      at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:33)

                      at com.google.gwt.dev.Precompile.precompile(Precompile.java:284)

                      at com.google.gwt.dev.Precompile.precompile(Precompile.java:233)

                      at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)

                      at com.google.gwt.dev.Compiler.run(Compiler.java:232)

                      at com.google.gwt.dev.Compiler.run(Compiler.java:198)

                      at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)

                      at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)

                      at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)

                      at com.google.gwt.dev.Compiler.main(Compiler.java:177)

                  [ERROR] <no source info>: public class org.jboss.errai.enterprise.client.cdi.events.BusReadyEvent

                      extends java.lang.Object

            /*   methods   */

            public void <init>()

             

             

             

             

             

             

                     org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding

                  [ERROR] at MarshallerFactoryImpl.java(417): public BusReadyEvent demarshall(EJValue a0, MarshallingSession a1) {

              try

                {

                  if ((a0.isNull() != null))

                      {

                        return null;

                      }

                  EJObject obj = a0.isObject();

                  String objId = obj.get("^ObjectID").isString().stringValue();

                  if (a1.hasObjectHash(objId))

                      {

                        return a1.getObject(BusReadyEvent.class, objId);

                      }

                  BusReadyEvent entity = new BusReadyEvent();

                  a1.recordObjectHash(objId, entity);

                  return entity;

                }

              catch (Throwable t)     {

                  t.printStackTrace();

                  throw new RuntimeException("error demarshalling entity: org.jboss.errai.enterprise.client.cdi.events.BusReadyEvent", t);

                }

            }

                     org.eclipse.jdt.internal.compiler.ast.MethodDeclaration

            • 3. Re: Possible RPC bus subscription/unsubscription bug
              csa

              Are you using the latest 2.0-SNAPSHOT of errai-cdi (errai-cdi-client and errai-weld-integration)? Also your GWT module needs to specify

               

              <inherits name="org.jboss.errai.enterprise.CDI"/>

               

              when you're using Errai-CDI.

              • 4. Re: Possible RPC bus subscription/unsubscription bug
                fvitorc

                That's weird. I've never used CDI version before. I've always used Errai SE Edition.

                Anyway, I did as you suggested, and now I get the following error:

                 

                   [ERROR] Errors in 'jar:file:/D:/development/library/errai-2.0-SNAPSHOT/lib/errai-jaxrs-client-2.0-SNAPSHOT.jar!/org/jboss/errai/enterprise/client/jaxrs/JaxrsModuleBootstrapper.java'

                      [ERROR] Line 33:  Rebind result 'org.jboss.errai.enterprise.client.jaxrs.JaxrsProxyLoader' must be a class

                   [ERROR] Cannot proceed due to previous errors

                 

                 

                Regards,

                Vitor.

                • 5. Re: Possible RPC bus subscription/unsubscription bug
                  csa

                  OK in that case it's different. If your app never depended on Errai-CDI it sill shouldn't of course. I just tested our plain Errai-Bus demos and they are still fine (no dep. on errai-cdi or errai-jaxrs). Do you depend on the errai-parent.pom by any chance? That's the only explanation I have. If you do, you will have to change that. If you don't, please post your pom.xml (maybe in a new thread).

                   

                  Thanks,

                  Christian

                  • 6. Re: Possible RPC bus subscription/unsubscription bug
                    fvitorc

                    I don't use maven.  I just copy the jars to my project.And the snapshot does not have multiple builds (one for pure Errai, and other for Errai CDI).

                    Anyway, just removed every errai-cdi* and errai-jaxrs* jars from the build path, and I was able to compile with no problems.

                     

                    And the bug reported here has been fixed. Thanks.

                     

                    Regards,

                    Vitor.