Bug P3
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: gerrit
Branch: stable-3.6
commit 5778c02f688d52d12d8603421cd08b1a84b0d199
Author: Marcin Czech <maczech@gmail.com>
Date: Mon Aug 07 16:52:26 2023
Avoid NullPointerException when deleting multiple tags
To avoid NPE make sure that ref is not read again after checking if
ref exists. This prevent the issue when other call already removed
the tag and we try to read it. Proper behaviour is to try to delete it
and return `Cannot delete refs/tags/...: LOCK_FAILURE` if tag is already
deleted.
Bug: Issue 291102119
Release-Notes: Avoid NullPointerException when deleting multiple tags
Change-Id: I8e19d756db2ecf15e6e5e61ec0346a7cfc6a85e3
M java/com/google/gerrit/server/restapi/project/DeleteRef.java
https://gerrit-review.googlesource.com/382076
Branch: stable-3.6
commit 5778c02f688d52d12d8603421cd08b1a84b0d199
Author: Marcin Czech <maczech@gmail.com>
Date: Mon Aug 07 16:52:26 2023
Avoid NullPointerException when deleting multiple tags
To avoid NPE make sure that ref is not read again after checking if
ref exists. This prevent the issue when other call already removed
the tag and we try to read it. Proper behaviour is to try to delete it
and return `Cannot delete refs/tags/...: LOCK_FAILURE` if tag is already
deleted.
Bug:
Release-Notes: Avoid NullPointerException when deleting multiple tags
Change-Id: I8e19d756db2ecf15e6e5e61ec0346a7cfc6a85e3
M java/com/google/gerrit/server/restapi/project/DeleteRef.java
sy...@gmail.com <sy...@gmail.com> #3
There is still a case that is uncovered by this fix and it has to do with a single tag deletion.
In the case of a single ref, `deleteMultipleRefs` falls back to `deleteSingleRef()`, which also suffers from the same race condition, causing the following NPE:
2023-09-21T14:58:32.107Z java.lang.NullPointerException
at com.google.gerrit.server.restapi.project.DeleteRef.deleteSingleRef(DeleteRef.java:119)
at com.google.gerrit.server.restapi.project.DeleteRef.deleteMultipleRefs(DeleteRef.java:174)
at com.google.gerrit.server.restapi.project.DeleteTags.apply(DeleteTags.java:50)
at com.google.gerrit.server.restapi.project.DeleteTags.apply(DeleteTags.java:31)
at com.google.gerrit.httpd.restapi.RestApiServlet.lambda$invokeRestModifyViewWithRetry$7(RestApiServlet.java:924)
at com.github.rholder.retry.AttemptTimeLimiters$NoAttemptTimeLimit.call(AttemptTimeLimiters.java:78)
at com.github.rholder.retry.Retryer.call(Retryer.java:160)
at com.google.gerrit.server.update.RetryHelper.executeWithTimeoutCount(RetryHelper.java:564)
at com.google.gerrit.server.update.RetryHelper.execute(RetryHelper.java:507)
at com.google.gerrit.server.update.RetryableAction.call(RetryableAction.java:173)
at com.google.gerrit.httpd.restapi.RestApiServlet.invokeRestEndpointWithRetry(RestApiServlet.java:999)
at com.google.gerrit.httpd.restapi.RestApiServlet.invokeRestModifyViewWithRetry(RestApiServlet.java:919)
at com.google.gerrit.httpd.restapi.RestApiServlet.service(RestApiServlet.java:565)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
In the case of a single ref, `deleteMultipleRefs` falls back to `deleteSingleRef()`, which also suffers from the same race condition, causing the following NPE:
2023-09-21T14:58:32.107Z java.lang.NullPointerException
at com.google.gerrit.server.restapi.project.DeleteRef.deleteSingleRef(DeleteRef.java:119)
at com.google.gerrit.server.restapi.project.DeleteRef.deleteMultipleRefs(DeleteRef.java:174)
at com.google.gerrit.server.restapi.project.DeleteTags.apply(DeleteTags.java:50)
at com.google.gerrit.server.restapi.project.DeleteTags.apply(DeleteTags.java:31)
at com.google.gerrit.httpd.restapi.RestApiServlet.lambda$invokeRestModifyViewWithRetry$7(RestApiServlet.java:924)
at com.github.rholder.retry.AttemptTimeLimiters$NoAttemptTimeLimit.call(AttemptTimeLimiters.java:78)
at com.github.rholder.retry.Retryer.call(Retryer.java:160)
at com.google.gerrit.server.update.RetryHelper.executeWithTimeoutCount(RetryHelper.java:564)
at com.google.gerrit.server.update.RetryHelper.execute(RetryHelper.java:507)
at com.google.gerrit.server.update.RetryableAction.call(RetryableAction.java:173)
at com.google.gerrit.httpd.restapi.RestApiServlet.invokeRestEndpointWithRetry(RestApiServlet.java:999)
at com.google.gerrit.httpd.restapi.RestApiServlet.invokeRestModifyViewWithRetry(RestApiServlet.java:919)
at com.google.gerrit.httpd.restapi.RestApiServlet.service(RestApiServlet.java:565)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
ap...@google.com <ap...@google.com> #5
Project: gerrit
Branch: stable-3.6
commit 29b4af9ee55ae16064b38db9c86255ac037d27e9
Author: Antonio Barone <syntonyze@gmail.com>
Date: Thu Sep 21 20:14:46 2023
Avoid NPE when deleting single ref
Change I8e19d756db fixed a bug where an NPE was thrown during the
deletion of multiple refs if one of them didn't exist, or possibly
already removed by a concurrent caller.
The `deleteMultipleRefs()` method however, falls back to calling the
`deleteSingleRef()` method, which also suffers from the same issue.
Fix the `deleteSingleRef()` method to account for unexisting refs, so
that a concurrent execution from another caller does not cause an NPE.
Release-Notes: Avoid NullPointerException when deleting a single ref
Bug: Issue 291102119
Change-Id: Ibe79290f4eb7332cc22e72c906fe5f60bedbcca6
M java/com/google/gerrit/server/restapi/project/DeleteRef.java
https://gerrit-review.googlesource.com/387103
Branch: stable-3.6
commit 29b4af9ee55ae16064b38db9c86255ac037d27e9
Author: Antonio Barone <syntonyze@gmail.com>
Date: Thu Sep 21 20:14:46 2023
Avoid NPE when deleting single ref
Change I8e19d756db fixed a bug where an NPE was thrown during the
deletion of multiple refs if one of them didn't exist, or possibly
already removed by a concurrent caller.
The `deleteMultipleRefs()` method however, falls back to calling the
`deleteSingleRef()` method, which also suffers from the same issue.
Fix the `deleteSingleRef()` method to account for unexisting refs, so
that a concurrent execution from another caller does not cause an NPE.
Release-Notes: Avoid NullPointerException when deleting a single ref
Bug:
Change-Id: Ibe79290f4eb7332cc22e72c906fe5f60bedbcca6
M java/com/google/gerrit/server/restapi/project/DeleteRef.java
Description
*** !!!! THIS BUG TRACKER IS FOR GERRIT CODE REVIEW !!!!
*** Do not submit bugs for chrome/android and issues with your company's
*** Gerrit setup here. Those issues belong in different issue trackers.
*************************************************************************
What steps will reproduce the problem?
1. Setup two Gerrit nodes with pull-replication
2. Run gatling tests for each node at the same time
What is the expected output?
All gatling test are successful
What do you see instead?
For some small number of tag deletions(1 out of 10 000) Gerrit returns 500
Please provide any additional information below.
In the logs I can see NullPointerException from:
This is a classic concurrency issue where in the middle of the ref delete pull-replication delete it as well.
Another thing is why we read ref twice[1] and [2] instead of reusing the variable.
1.
2.