Affects Version/s: 6.1.20 EE GA2
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