RFR: 1035: Race when creating backports for bug spanning multiple repos [v2]
Zhao Song
zsong at openjdk.org
Thu Feb 16 17:25:13 UTC 2023
On Thu, 16 Feb 2023 17:14:35 GMT, Vijay Kulkarni <duke at openjdk.org> wrote:
>> bots/notify/src/main/java/org/openjdk/skara/bots/notify/issue/IssueNotifier.java line 310:
>>
>>> 308: try {
>>> 309: issue = jbsBackport.createBackport(issue, requestedVersion, username.orElse(null), defaultSecurity(branch));
>>> 310: } catch (Exception exp) {
>>
>> Catching `Exception` is too wide a net. We need to catch `UncheckedRestException` and ideally check that the response code indicates this kind of error. Unfortunately I don't know what response that would be, so perhaps it's ok to just change the exception type for now.
>>
>> Exception variables in catch statements are usually just called `e` in this codebase.
>
> Yes, I agree, used the more specific exception as suggested.
>
> Regarding the specific exception code, yes I tried to run two test cases in parallel by putting the debug points to simulate the race condition but TestHost returned 2nd issue as a new one. I guess because of two instances of TestHost (one per test case). So could not verify the exception code.
If you are interested, I think you can add the status code to the log with method `UncheckedRestException#getStatusCode`.
-------------
PR: https://git.openjdk.org/skara/pull/1476
More information about the skara-dev
mailing list