eclipse-ee4j / mojarra

Mojarra, a Jakarta Faces implementation
Other
160 stars 109 forks source link

Nested includes can cause IndexOutOfBoundsException on clustered environment after some AJAX requests #4615

Closed rvieira5 closed 1 year ago

rvieira5 commented 5 years ago

In our company, we simulate a single page app with JSF (using the AJAX functionality provided by Mojarra).

Recently, we received a requirement to enable the application to run in multiple instances. For load balancing reasons, we chose to use an approach of session sharing using Memcached, instead of the solution based on sticky sessions.

During the process of configuring the application to run on multiple instances (for instance, converting the view scoped managed beans to serializable, adding <distributable /> tag on web.xml etc), we discovered an error which happens when the AJAX is used intensely (as we do in our application). We think this error is critical because it happens in a critical part of our application (and it can happen in other pages as well).

error-screenshot

It is important to note that the error doesn't happen every time, so it seems to have a probabilistic factor there.

I made a project with a minimal set of files I could extract from the application, which can be used to reproduce and analyse the error:

https://github.com/rvieira5/mojarra-ajax-error-clustered-environment/

We tested this in the following environments:

arjantijms commented 5 years ago

Thanks for the report. That will be fun to debug ;)

altuure commented 4 years ago

I see the same error. This happens as IdMapper contains different values for same keys in different instance of servers. (eg: rendered component A has id j_idt38 on instance1 while it is j_idt37 on instance2, so as you post from instance1 to instance2 or vice-versa, error happens).

This can result of different order of includes depending on code or request type (html or ajax)

have no solution or work around yet :(

leomekenkamp commented 4 years ago

Please note that this bug also happens when the (Tomcat) server instances do not share their session data and the javax.faces.STATE_SAVING_METHOD param has been set to client.

mnriem commented 1 year ago

For Mojarra 2.3 and earlier please contact your vendor for support (RedHat, IBM, Oracle, Omnifish, Payara, etceteras)