Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-66798

Liferay does not acquire a lock when incrementing Counter, causing errors when clustering



      Liferay uses Hibernate to acquire a lock for the Counter when incrementing it, but this fails, so when multiple nodes attempt to access it, both may succeed, causing issues when clustering stemming from duplicate ID's.

      Used the customer's custom auto-login hook for testing (which is intended for 6.1.20), which generates a new user whenever signed out, as well as JMeter tests to allow multiple nodes to trigger this behavior constantly, causing a high chance for a race condition. Trying to create a similar race condition by breaking when using the UI to increment the Counter will cause the second request to wait for the first before continuing, so it will not reproduce this issue.

      Steps used for testing:

      1. Set up and run at least two clustered Liferay nodes connected to the same database, and set counter.increment=10 in their portal-ext.properties
      2. Deploy the attached plugin on both nodes.
      3. On the Liferay site, deploy the plugin on a page.
      4. On both nodes, type in a large number (at least 1000), and click Execute.

      Expected result: both nodes will be able to successfully execute the request to create many list types
      Actual result: both nodes successfully acquire access to the Counter, causing a ConstraintViolationException when the list types are added


          Issue Links



              preston.crary Preston Crary
              alec.shay Alec Shay
              Participants of an Issue:
              Recent user:
              Brian Wulbern
              0 Vote for this issue
              1 Start watching this issue


                Days since last comment:
                5 years, 1 day ago


                  Version Package
                  6.1.2 CE GA3
                  6.1.30 EE GA3