11 Replies Latest reply on Apr 25, 2014 1:29 AM by bleathem

    Infrequent AJAX Request Failure

    youth.9009

      Hi All,

       

      I'm facing one issue where the request are failing infrequently. The application works fine and at times some requests are hanging.

      This is happening when I click on any of the a4j:commandbutton / a4j:commandlink.

      When I have enabled the a4j:log and developer tools in IE. I got the below logs when the issue is happening.

       

      info [14:44:32.885]: Server returned responseText:

      debug[14:44:32.887]: richfaces.queue: ajax submit error

      debug[14:44:32.888]: richfaces.queue: Nothing to submit

      error[14:44:32.889]: Received 'error@httpError' event from <a id=graphForm:j_idt105:1:j_idt107:3:graphRefreshLink1 ...>

      error[14:44:32.894]: [12152] undefined: undefined

       

      In the developer tools, the request doesn't have any header/body and also it is in aborted status.

       

      Please help/advice me in this issues.

       

      Note : I'm using 4.10.final in my application.

       

      Thanks,

        • 1. Re: Infrequent AJAX Request Failer
          youth.9009

          Hi All,

           

          I'm able to capture the error and display a custom message.

           

          jsf.ajax.addOnError(showAjaxError);

          function showAjaxError(data){

          if(data.type == "error" && data.status == "httpError"  ){
          // Show Error Message
          }

          }

           

          Hope this will be helpful for some one and let me know if we have any other ways.

           

          Thanks,

          1 of 1 people found this helpful
          • 2. Re: Re: Infrequent AJAX Request Failer
            bleathem

            RichFaces 4.1 is pretty old.  have you tried RichFaces 4.3.4.Final?  Also, what impl/version of JSF are you using?  In what container?

            • 3. Re: Re: Infrequent AJAX Request Failer
              youth.9009

              We have upgraded to RichFaces 4.3.4.final recently and still we see this issue at times. Its very random and coming for any ajax request.

              • 4. Re: Re: Infrequent AJAX Request Failer
                bleathem

                What impl/version of JSF are you using?  In what container?


                Is there an associated error log on the server?

                • 5. Re: Infrequent AJAX Request Failer
                  youth.9009

                  It looks like when one requests get client error, the further requests in queue is not getting triggered. Also the new requests also not working.

                  We are getting the below javascript error which is cause for this issue.

                   

                  SCRIPT5007: Unable to get value of the property 'getItems': object is null or undefined

                  packed.js, line 6569 character 19

                   

                  So this is bug in Queue implementation

                  • 6. Re: Infrequent AJAX Request Failer
                    bleathem

                    Can you file a jira issue with sample code and steps to reproduce?

                    • 7. Re: Infrequent AJAX Request Failer
                      youth.9009

                      Hi Brian,

                       

                      https://issues.jboss.org/browse/RF-12132 ( [RF-12132] Richfaces queue not cleared after js error in oncomplete attribute - JBoss Issue Tracker  )

                       

                      This is the issue happening for me also, but problem for me is that it happens randomly and I couldn't actually capture the scenario where the js error happening.

                       

                      But from the developer console, I'm able to see the javascript error and the further requests are not processing as we have the below logic in richfaces-queue.js .

                       

                      var submitFirstEntry = function() {

                      if (QUEUE_MODE == QUEUE_MODE_PULL && lastRequestedEntry) {

                           richfaces.log.debug("richfaces.queue: Waiting for previous submit results");

                           return;

                      }

                       

                      Also I could see the onError handler logic, but it looks the java script errors are not being captured by this handler. So this request keep on waiting for the result which prevents further request processing.

                       

                      Please let me know if we have any workaround until the issue is fixed in richfaces 5.

                       

                      Thanks,

                      • 8. Re: Infrequent AJAX Request Failer
                        bleathem

                        We'll have a look.  However any contributions you can make in terms of providing a reliable means of reproducing will expedite the process of identifying the issue, finding any possible workarounds, and ultimately providing a fix.

                        • 9. Re: Infrequent AJAX Request Failer
                          youth.9009

                          Actually we are getting the below error in packed.js.

                           

                          SCRIPT5007: Unable to get value of the property 'getItems': object is null or undefined

                          packed.js, line 6569 character 19

                           

                          So to replicate & debug easier, I have changed the compressedStage. Then figured out that the js error is happening in the below line of Autocomplete.js

                           

                          var updateItemsFromCache = function (value) {

                                  var newItems = this.cache.getItems(value, this.options.filterFunction);

                                  this.items = $(newItems);

                                  //TODO: works only with simple markup, not with <tr>

                                  $(rf.getDomElement(this.id + ID.ITEMS)).empty().append(this.items);

                          };

                           

                          In certain scenarios, this.cache becomes undefined which triggers the above js error in the console. This can be replicated if we clear the list bound to autocomplete.

                          i.e. if I make rateRow.makes as null & rateRow.makeCode as not null based on certain condition, further request on autocomplete throws the above js error.

                           

                          <rich:autocomplete mode="lazyClient" id="makeCodes"

                            minChars="0" layout="table"

                            inputClass="autoCompleteInputMandatory"  popupClass="autoCompletePopup"

                            selectFirst="false" autofill="false" showButton="true"

                            autocompleteList="#{rateRow.makes}"

                            value="#{rateRow.makeCode}"

                            var="codeObj" fetchValue="#{codeObj}"

                            tokens=",[]" status="commonStatus" >

                            <h:column>#{codeObj}</h:column>

                          </rich:autocomplete>

                           

                           

                          I have made this change to replicate the error, but this is not my actual scenario and I couldn't actually figure why it is happening.

                           

                          Hope this will useful and still trying to identify the issue here.

                          • 10. Re: Infrequent AJAX Request Failer
                            youth.9009

                            I have made a temporary fix by passing a list with one empty value.

                            I have done this by changing all the autocomplete with LazyClient mode to use AutocompleteMethod instead of AutoCompleteList.

                            This seems to be fixed the issue. But this could be better if it is fixed in the ExtendedDataTable.js to consider the null scenario as well.

                             

                            Also the request hangs in queue if any JavaScript error happens which causes the page becomes unresponsive as further requests are waiting for previous request to complete which is never going to happen.

                             

                            Its would be better if we handle these kind of scenarios too as its impact is huge.

                            • 11. Re: Infrequent AJAX Request Failer
                              bleathem

                              Nice debug work.  Would you mind filing a jira issue with your description and workaround?  Attaching any reproducers you may have would help too.