3 Replies Latest reply on Mar 26, 2008 6:38 PM by Arbi Sookazian

    Bug in eventsQueue implementation?

    Mathias Stein Newbie

      As described in the AJAX4JSF dev guide, using an eventsQueue should avoid concurrent AJAX requests.
      See "5.4.2. Queue and Traffic Flood Protection"
      http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/html/ArchitectureOverview.html

      But the following example seems to work partly incorrectly: (simple text repeater)

      <h:inputText value="#{someBean.text}">
       <a4j:support eventsQueue="myqueue" event="onkeyup" reRender="repeater" />
      </h:inputText>
      <h:outputText id="repeater" value="#{someBean.text}" />
      <a4j:log popup="false" level="ALL" />


      Szenario:
      1. While a first event is still being processed on the server, a second event is deferred and queued correctly.
      2. After receiving the response for the first event, the queued second event is sent as expected.
      3. But while the second event is being processed on the server, another third event is not queued correctly. Instead the third event is sent immediately.
      ==> Thus event 2 and event 3 are processed concurrently.

      Is this the desired behavior?

      Thanks,
      Mathias


      a4j:log with comments
      ---------------------------

      Input event "1"

      debug[10:39:37,553]: Have Event [object Object] with properties: target: undefined, srcElement: [object], type: keyup
      debug[10:39:37,553]: NEW AJAX REQUEST !!! with form :ComplexDialogForm
      debug[10:39:37,553]: Append text control ComplexDialogForm:_id3 with value [1] and value attribute [1]
      debug[10:39:37,569]: Append hidden control ComplexDialogForm_SUBMIT with value [1] and value attribute [1]
      debug[10:39:37,569]: Append hidden control javax.faces.ViewState with value [...
      debug[10:39:37,569]: parameter ComplexDialogForm:_id4 with value ComplexDialogForm:_id4
      debug[10:39:37,569]: Start XmlHttpRequest
      debug[10:39:37,569]: Reqest state : 1
      debug[10:39:37,569]: QueryString: AJAXREQUEST=_viewRoot&ComplexDialogForm%3A_id3=1&ComplexDialogForm_SUBMIT=1...


      Input event "2"

      debug[10:39:42,334]: Have Event [object Object] with properties: target: undefined, srcElement: [object], type: keyup
      debug[10:39:42,334]: Put new event to queue myqueue


      Response on Input event "1"

      debug[10:39:46,240]: Reqest state : 2
      debug[10:39:46,240]: Reqest state : 3
      debug[10:39:46,240]: Reqest state : 4
      debug[10:39:46,240]: Reqest end with state 4
      debug[10:39:46,240]: Response with content-type: text/xml;charset=UTF-8
      debug[10:39:46,240]: Full response content: ...
      debug[10:39:46,240]: Update page by list of rendered areas from response ComplexDialogForm:repeater
      debug[10:39:46,240]: search for elements by name 'script' in element #document
      debug[10:39:46,240]: selectNodes found 1
      debug[10:39:46,240]: script in response with src=/QuasarClient/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf
      debug[10:39:46,240]: Such element exist in document
      debug[10:39:46,240]: search for elements by name 'link' in element #document
      debug[10:39:46,240]: selectNodes found 0
      debug[10:39:46,240]: Attempt to update part of page for Id: ComplexDialogForm:repeater
      debug[10:39:46,240]: call selectSingleNode for id= ComplexDialogForm:repeater
      debug[10:39:46,240]: Replace content of node by outerHTML()
      debug[10:39:46,240]: search for elements by name 'script' in element span
      debug[10:39:46,240]: selectNodes found 0
      debug[10:39:46,256]: Scripts in updated part count : 0
      debug[10:39:46,256]: Update part of page for Id: ComplexDialogForm:repeater successful
      debug[10:39:46,256]: call selectSingleNode for id= ajax-update-ids
      debug[10:39:46,256]: Hidden JSF state fields:
      debug[10:39:46,256]: Namespace for hidden view-state input fields is undefined
      debug[10:39:46,256]: search for elements by name 'input' in element span
      debug[10:39:46,256]: selectNodes found 1
      debug[10:39:46,256]: Replace value for inputs: 3 by new values: 1
      debug[10:39:46,256]: Input in response: javax.faces.ViewState
      debug[10:39:46,256]: Found same input on page with type: hidden
      debug[10:39:46,256]: search for elements by name 'INPUT' in element span
      debug[10:39:46,256]: selectNodes found 0
      debug[10:39:46,256]: Replace value for inputs: 3 by new values: 0
      debug[10:39:46,256]: call selectSingleNode for id= _A4J.AJAX.focus
      debug[10:39:46,256]: No focus information in response


      Send queued request on Input event "1"

      debug[10:39:46,256]: Queue not empty, execute next request in queue myqueue
      debug[10:39:46,256]: NEW AJAX REQUEST !!! with form :ComplexDialogForm
      debug[10:39:46,256]: Append text control ComplexDialogForm:_id3 with value [12] and value attribute [12]
      debug[10:39:46,256]: Append hidden control ComplexDialogForm_SUBMIT with value [1] and value attribute [1]
      debug[10:39:46,272]: Append hidden control javax.faces.ViewState with value [...
      debug[10:39:46,272]: parameter ComplexDialogForm:_id4 with value ComplexDialogForm:_id4
      debug[10:39:46,272]: Start XmlHttpRequest
      debug[10:39:46,272]: Reqest state : 1
      debug[10:39:46,272]: QueryString: AJAXREQUEST=_viewRoot&ComplexDialogForm%3A_id3=12&ComplexDialogForm_SUBMIT=1...


      Input event "3" (Processing of Input event "2" is still running)

      debug[10:39:50,084]: Have Event [object Object] with properties: target: undefined, srcElement: [object], type: keyup
      debug[10:39:50,084]: NEW AJAX REQUEST !!! with form :ComplexDialogForm


      !!! Problem !!!
      Input event "3" is send immediately, instead of beeing queued

      debug[10:39:50,084]: Append text control ComplexDialogForm:_id3 with value [123] and value attribute [123]
      debug[10:39:50,084]: Append hidden control ComplexDialogForm_SUBMIT with value [1] and value attribute [1]
      debug[10:39:50,100]: Append hidden control javax.faces.ViewState with value [...
      debug[10:39:50,100]: parameter ComplexDialogForm:_id4 with value ComplexDialogForm:_id4
      debug[10:39:50,100]: Start XmlHttpRequest
      debug[10:39:50,100]: Reqest state : 1
      debug[10:39:50,100]: QueryString: AJAXREQUEST=_viewRoot&ComplexDialogForm%3A_id3=123&ComplexDialogForm_SUBMIT=1...


      Response on Input event "2"

      debug[10:39:54,350]: Reqest state : 2
      debug[10:39:54,350]: Reqest state : 3
      debug[10:39:54,350]: Reqest state : 4
      debug[10:39:54,350]: Reqest end with state 4
      debug[10:39:54,350]: Response with content-type: text/xml;charset=UTF-8
      debug[10:39:54,350]: Full response content: ...
      debug[10:39:54,350]: Update page by list of rendered areas from response ComplexDialogForm:repeater
      debug[10:39:54,350]: search for elements by name 'script' in element #document
      debug[10:39:54,350]: selectNodes found 1
      debug[10:39:54,350]: script in response with src=/QuasarClient/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf
      debug[10:39:54,350]: Such element exist in document
      debug[10:39:54,350]: search for elements by name 'link' in element #document
      debug[10:39:54,365]: selectNodes found 0
      debug[10:39:54,365]: Attempt to update part of page for Id: ComplexDialogForm:repeater
      debug[10:39:54,365]: call selectSingleNode for id= ComplexDialogForm:repeater
      debug[10:39:54,365]: Replace content of node by outerHTML()
      debug[10:39:54,365]: search for elements by name 'script' in element span
      debug[10:39:54,365]: selectNodes found 0
      debug[10:39:54,365]: Scripts in updated part count : 0
      debug[10:39:54,365]: Update part of page for Id: ComplexDialogForm:repeater successful
      debug[10:39:54,365]: call selectSingleNode for id= ajax-update-ids
      debug[10:39:54,365]: Hidden JSF state fields:
      debug[10:39:54,365]: Namespace for hidden view-state input fields is undefined
      debug[10:39:54,365]: search for elements by name 'input' in element span
      debug[10:39:54,365]: selectNodes found 1
      debug[10:39:54,365]: Replace value for inputs: 3 by new values: 1
      debug[10:39:54,365]: Input in response: javax.faces.ViewState
      debug[10:39:54,365]: Found same input on page with type: hidden
      debug[10:39:54,365]: search for elements by name 'INPUT' in element span
      debug[10:39:54,381]: selectNodes found 0
      debug[10:39:54,381]: Replace value for inputs: 3 by new values: 0
      debug[10:39:54,381]: call selectSingleNode for id= _A4J.AJAX.focus
      debug[10:39:54,381]: No focus information in response


      Response on Input event "2"

      debug[10:39:58,147]: Reqest state : 2
      debug[10:39:58,147]: Reqest state : 3
      debug[10:39:58,147]: Reqest state : 4
      debug[10:39:58,147]: Reqest end with state 4
      debug[10:39:58,147]: Response with content-type: text/xml;charset=UTF-8
      debug[10:39:58,147]: Full response content: ...
      debug[10:39:58,147]: Update page by list of rendered areas from response ComplexDialogForm:repeater
      debug[10:39:58,147]: search for elements by name 'script' in element #document
      debug[10:39:58,147]: selectNodes found 1
      debug[10:39:58,147]: script in response with src=/QuasarClient/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf
      debug[10:39:58,147]: Such element exist in document
      debug[10:39:58,147]: search for elements by name 'link' in element #document
      debug[10:39:58,147]: selectNodes found 0
      debug[10:39:58,147]: Attempt to update part of page for Id: ComplexDialogForm:repeater
      debug[10:39:58,147]: call selectSingleNode for id= ComplexDialogForm:repeater
      debug[10:39:58,162]: Replace content of node by outerHTML()
      debug[10:39:58,162]: search for elements by name 'script' in element span
      debug[10:39:58,162]: selectNodes found 0
      debug[10:39:58,162]: Scripts in updated part count : 0
      debug[10:39:58,162]: Update part of page for Id: ComplexDialogForm:repeater successful
      debug[10:39:58,162]: call selectSingleNode for id= ajax-update-ids
      debug[10:39:58,162]: Hidden JSF state fields:
      debug[10:39:58,162]: Namespace for hidden view-state input fields is undefined
      debug[10:39:58,162]: search for elements by name 'input' in element span
      debug[10:39:58,162]: selectNodes found 1
      debug[10:39:58,162]: Replace value for inputs: 3 by new values: 1
      debug[10:39:58,162]: Input in response: javax.faces.ViewState
      debug[10:39:58,162]: Found same input on page with type: hidden
      debug[10:39:58,162]: search for elements by name 'INPUT' in element span
      debug[10:39:58,162]: selectNodes found 0
      debug[10:39:58,162]: Replace value for inputs: 3 by new values: 0
      debug[10:39:58,162]: call selectSingleNode for id= _A4J.AJAX.focus
      debug[10:39:58,178]: No focus information in response


      Test environment
      --------------------
      - ajax4jsf-1.1.1
      - firefox 2.0.0.12 or IE 6.0
      - MyFaces 1.1.5


        • 1. Re: Bug in eventsQueue implementation?
          Ilya Shaikovsky Master

          you have too old framework version. Please update to Rich Faces 3.1.4 GA.

          • 2. Re: Bug in eventsQueue implementation?
            Mathias Stein Newbie

            Hi Ilya,

            the behaviour is still unchanged in Rich Faces 3.1.4 GA.

            Since i am stuck to JSF 1.1, I haven't tested the current 3.2.0 SVN head yet.

            But in case it was already fixed in the 3.2.0 SVN head, whether/when will a patch for 3.1.4 be available?
            Or will the issue be fixed in a Rich Faces Version 3.1.5?

            Thanks,
            Mathias

            • 3. Re: Bug in eventsQueue implementation?
              Arbi Sookazian Master

              using Seam 2.0.0.GA, JBoss 4.2.1.GA, Richfaces 3.1.3.GA.

              I am having the same problem. Please refer to the following thread:

              http://www.seamframework.org/Community/ConversationEndedTimedOutOrWasProcessingAnotherRequest

              Here is the pertinent code from the facelet:

              <a4j:form id="locationform">
               <b style="font-size: 14px"><u><h:outputText id="techLocname" value="#{techDeployToUser.techLocationName}"></h:outputText></u></b>
               <h:inputText id="userlocationno" value="#{techDeployToUser.locNo}" valueChangeListener="#{techDeployToUser.validateUserLocation}" maxlength="4" size="26">
              
               <input type="hidden" name="inputlocno" value="#{techDeployToUser.locNo}"/>
               </h:inputText>
               <a4j:commandButton id="locationSubmit" value="Search" type="button" oncomplete="return clearUserLocMsg();" reRender="userQueueTable, userLocMsg, techLocMsg, userlocname, assignButtonA4JForm, techQueueTable"/>
               <br></br>
              
               <rich:suggestionbox id="suggestionboxid" requestDelay="1000" ignoreDupResponses="true" eventsQueue="myqueue" width="182" height="80" ajaxSingle="true" limitToList="false" border="5" for="userlocationno" suggestionAction="#{techDeployToUser.autoSuggestLocNosList}" var="locNosList" fetchValue="#{locNosList.locationNo}">
               <h:column>
               <b> <h:outputText id="sellocno" value="#{locNosList.locationNo}"/> </b>
               </h:column>
               </rich:suggestionbox>
              
               </a4j:form>


              Per Christian Bauer, I added
              eventsQueue="myqueue"
              to the suggestionBox tag. This did not fix the problem (concurrent request timeout). I then added
              requestDelay="1000" ignoreDupResponses="true"
              and I was unable to reproduce the error. This workaround is unacceptable b/c I can't lower the requestDelay and it's too long now. If I lower it below 1000, the problem is reproducable.

              Bauer said in the thread above to open a JIRA for Richfaces if the eventsQueue by itself does not fix the problem.

              It sounds like this may be fixed. What is the JIRA #/name for this issue?

              Also, we can't upgrade to a newer GA version of Richfaces b/c we are using JBoss EAP 4.3 currently. Therefore, we are limited to the version of Seam (currently for us it's 2.0.0.GA) and Richfaces in that Seam distro.

              Do you know what version of richfaces will be included with Seam 2.1x?

              thx.