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

Race condition occurs when multiple requests try to write to the same entry in a database table

    Details

      Description

      Edit: a more generic set of steps:
      Step 1: start bundle and create a new user, say test1@liferay.com, and record its userId to replace userId in following steps
      Step 2: Call json api to update user password, a few times with different question and answer
      curl http://localhost:8080/api/jsonws/user/update-reminder-query -u test@liferay.com:test -d userId=36596 -d question='abc' -d answer='cba'
      Noticing that everytime the request will have desired response
      Step 3: Now combine more than 1 requests together in one command, ie making the server handle multi-requests at the same time, by calling
      curl http://localhost:8080/api/jsonws/user/update-reminder-query -u test@liferay.com:test -d userId=36596 -d question='abc' -d answer='cba' & curl http://localhost:8080/api/jsonws/user/update-reminder-query -u test@liferay.com:test -d userId=36596 -d question='def' -d answer='fed' & curl http://localhost:8080/api/jsonws/user/update-reminder-query -u test@liferay.com:test -d userId=36596 -d question='ghi' -d answer='ihg'

      Expected: all requests are served well, with desired response.
      Real: some of the responses are saying: optimistic lock failed.

      Step 1: Set auth.pipeline.enable.liferay.check=false, so that any one can login using test@liferay.com account with any password
      Step 2: Start bundle
      Step 3: Test connection by calling
      curl http://localhost:8080/api/jsonws/group/get-user-sites-groups -u "test@liferay.com:dummy1"
      from command line
      Step 4: Test connection again by calling
      curl http://localhost:8080/api/jsonws/group/get-user-sites-groups -u "test@liferay.com:dummy2"
      from command line
      Step 5: Test connection again by calling
      curl http://localhost:8080/api/jsonws/group/get-user-sites-groups -u "test@liferay.com:dummy3"
      from command line
      Step 6: Test connection again by calling
      curl http://localhost:8080/api/jsonws/group/get-user-sites-groups -u "test@liferay.com:dummy4"
      from command line

      Noticing that all requests will have desired response

      Step 7: Now combine 4 requests together in one command, ie making the server handle multi-requests at the same time, by calling
      curl http://localhost:8080/api/jsonws/group/get-user-sites-groups -u "test@liferay.com:dummy1" & curl http://localhost:8080/api/jsonws/group/get-user-sites-groups -u "test@liferay.com:dummy2" & curl http://localhost:8080/api/jsonws/group/get-user-sites-groups -u "test@liferay.com:dummy3" & curl http://localhost:8080/api/jsonws/group/get-user-sites-groups -u "test@liferay.com:dummy4"
      from command line

      Expected: all requests are served well, with desired response.
      Real: some of the responses are saying: access denied.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                arthur.chen Arthur Chen
                Reporter:
                arthur.chen Arthur Chen
                Participants of an Issue:
                Recent user:
                Arthur Chen
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  45 weeks, 4 days ago

                  Packages

                  Version Package