3 Replies Latest reply on May 11, 2012 12:52 PM by Jonathan Fuerth

    Client message bus stopping

    Chris Roberts Newbie

      I've had cases where the client message bus stops.

       

      From the client log I can see that the JSON payload was invalid. It looks like it was truncated, so couldn't parse the content which resulted a message delivery failure.

       

      This resulted in the clinet bus reinitializing and sucessfully connecting with the server.

       

      1. the incoming message was 400k. Is there a limit I should watch out for? Or did I just get unlucky?

       

      2. the reinit'ed client message bus doesn't re-subscribe to the previous subscriptions, so from a user's point of view, the application gets no updates etc. Any suggestions on how I should deal with this? 

        • 1. Re: Client message bus stopping
          Jonathan Fuerth Master

          Hi Chris,

           

          To answer your questions,

           

          1. the incoming message was 400k. Is there a limit I should watch out for? Or did I just get unlucky?

           

          On the server side, Errai 2 uses a shared ring buffer to store messages that are being transmitted and received. This does limit the maximum message size to the size of the whole buffer on an otherwise quiet system. But the default buffer size is tens of megabytes. I just verified (using the bus-stress-test demo app) that messages with a 500k payload can pass through in both directions when using the default buffer settings. If fact, even when I try to overload it by sending a burst of 20 500k messages every second, the latency goes way up, but the bus does eventually catch up after I stop sending the bursts.

           

          If you want to play with the stress test app in your environment, you can find it here:

           

          https://github.com/errai/errai/tree/master/errai-bus/demos/bus-stress-test

           

          2. the reinit'ed client message bus doesn't re-subscribe to the previous subscriptions, so from a user's point of view, the application gets no updates etc. Any suggestions on how I should deal with this? 

           

          I'm going to defer to Mike Brock on how this is expected to work. It may be the case that you need to resubscribe, but in my own apps, this has never been an issue. I always found that the bus subscriptions outlasted bus reconnects, for example when a mobile phone goes to sleep and I come back to the page hours later.

           

          Perhaps the specific error condition you were in (due to the apparently corrupted message payload) got the bus into a confused state.

           

          -Jonathan

          1 of 1 people found this helpful
          • 2. Re: Client message bus stopping
            Chris Roberts Newbie

            Thanks for the pointer to the stress test.

             

            Where can I find what buffer settings I can modifiy? I vaguely remember seeing a jira on adding to the docs on the subject, but I can't seem to find now.

             

            My plan on the resubscribe is to register an unsubscribe listener  on the bus and to add a post init task to re-subscribe.

            • 3. Re: Client message bus stopping
              Jonathan Fuerth Master

              Hi Chris,

               

              The properties are errai.bus.buffer_size, errai.bus.buffer_segment_size, and errai.bus.buffer_segment_count. You only need to specify two out of the three.

               

              I've added detailed documentation for these settings to the Reference Guide: https://docs.jboss.org/author/display/ERRAI/ErraiService.properties. Thanks for holding us to account on this.

               

              -Jonathan