[seam-issues] [JBoss JIRA] (JBSEAM-3848) Seam fails to create and inject components when multiple ajax-requests are fired from a commandLink or commandButton, using ajax4jsf.

Marek Novotny (JIRA) jira-events at lists.jboss.org
Mon Feb 20 07:56:36 EST 2012


    [ https://issues.jboss.org/browse/JBSEAM-3848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12669184#comment-12669184 ] 

Marek Novotny commented on JBSEAM-3848:
---------------------------------------

I have reproduced the situation with the exception if there is set up 5 seconds delay in Booking example HotelSearchingAction.find() method. 
But this is not real Seam issue and should be handled in UI code.

What is behind this exception? Concurrent access to hotelSearch fields and while hotelSeach component is delayed in find method, access to it is locked, even it is in the same request. 
Seam component which is also Stateful Session Bean is automatically synchronized, therefore there is org.jboss.seam.core.LockTimeoutException with message: could not acquire lock on @Synchronized component: hotelSearch when on page is also evaluation of EL expression \#\{hotelSearch.nextPageAvailable\}

{code:xml}
<s:link id="MoreResultsLink" value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}"/>
{code}

This exact case should be handled as it is described in http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/html_single/index.html#QueueandTrafficFloodProtection

My try on this was to use the following while I have got still 5 sec delay in hotelSearch.find():
{code:xml}
<a4j:queue requestDelay="1000" ignoreDupResponce="true"/>
{code}
And that fixes it completely. 
                
> Seam fails to create and inject components when multiple ajax-requests are fired from a commandLink or commandButton, using ajax4jsf.
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-3848
>                 URL: https://issues.jboss.org/browse/JBSEAM-3848
>             Project: Seam 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0.BETA1
>         Environment: windows vista / rhel4
> sun jdk5, jdk6 latest versions
> jboss as 4.2.2 and 4.2.3
> firefox2 and 3, ie 6 and 7.
>            Reporter: etirk etirk
>            Assignee: Marek Novotny
>              Labels: a4j, ajax, core, jsf, seam
>             Fix For: 2.3.0.BETA1
>
>   Original Estimate: 2 days
>  Remaining Estimate: 2 days
>
> Seam fails to create and inject components when multiple ajax-requests are fired from a commandLink or commandButton, using ajax4jsf.
> Replication found using seam-booking in examples, trunk as of 081216.
> Rewrite the find-method in the HotelSearchAction-class, in the seam booking example application. It should look like this.
> public void find() {
>         page = 0;
>         queryHotels();
>         try {
>             Thread.sleep(1000 * 5);
>         } catch (InterruptedException ignore) {
>         }
>     }
> Now, start the application, register a user and enter main.html. Click multiple times on the search hotel button. Depending upon how fast your computer is, you might need to do more than a double-click. Sometimes you may need to klick fast up to 5-8 times. But it will occur.
> You will end up with an exception that says:
> Caused by javax.servlet.ServletException with message: javax.el.ELException: /main.xhtml @74,130 rendered=#{hotelSearch.nextPageAvailable}: Error reading nextPageAvailable on type org.javassist.tmp.java.lang.Object_$$_javassist_4
> Which in turn comes from a synchronization problem.
> Caused by org.jboss.seam.core.LockTimeoutException with message: could not acquire lock on @Synchronized component: hotelSearch
> This is in a way funny, since the hotelSearch-component is not annotated with synchronized. Anyway, our application does not throw an exception like this, but we to have tried synchronizing our involved components, with no luck. Our exception is mostly this
> Caused by javax.servlet.ServletException with message: javax.el.ELException: /layout/template.xhtml @18,59 rendered=#{authenticator.inSpecialMode}: Error reading inSpecialMode on type se.session.Authenticator_$$_javassist_4
> Which in turn comes from the failed injections
> Caused by org.jboss.seam.RequiredException with message: @In attribute requires non-null value: authenticator.entityManager 
> This problem occurs all over the application, always when an ajax request is double-clicked and seam tries to recreate seam components and runs out of time. In 99% of the case it is the first read property of our authenticator-component that fails, and most often it is that seam cannot create a entityManager to inject, and the system fails due to that the annotation is set to only inject, without create. Removing the entityManager from the component will only result in that seam cannot inject another component instead, until you have no injections left in authenticator, and it still fails! 
> Similar behaviour has been noticed using non-ajax calls, using standard h:commandButton/Link. This is however much more rare.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list