----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/73365/#review223076 -----------------------------------------------------------
security-admin/src/main/java/org/apache/ranger/common/db/RangerTransactionSynchronizationAdapter.java Lines 158 (patched) <https://reviews.apache.org/r/73365/#comment312215> 'runnables' parameter is the list from ThreadLocals RUNNABLE and RUNNABLE_AFTER_COMMIT. No changes to these list should happen while executing runRunnables() - unless a runnable being executed ends up calling one of the following methods: - RangerTransactionSynchronizationAdapter.executeOnTransactionCompletion() - RangerTransactionSynchronizationAdapter.executeOnTransactionCommit() If above indeed happens, that sounds like a bug. Do you have specific scenario that triggers this condition? Also, I suggest the following to handle this scenario: Update the following: public void afterCompletion(int status) { .. runRunnables(RUNNABLES_AFTER_COMMIT.get(), true); RUNNABLES_AFTER_COMMIT.remove(); .. runRunnables(RUNNABLES.get(), false); RUNNABLES.remove(); .. } To: public void afterCompletion(int status) { .. List<Runnable> runnablesAfterCommit = RUNNABLES_AFTER_COMMIT.get(); List<Runnable> runnables = RUNNABLES.get(); RUNNABLES_AFTER_COMMIT.remove(); RUNNABLES.remove(); runRunnables(runnablesAfterCommit, true); runRunnables(runnables, false); .. } - Madhan Neethiraj On May 26, 2021, 11:24 a.m., Chia-Ping Tsai wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/73365/ > ----------------------------------------------------------- > > (Updated May 26, 2021, 11:24 a.m.) > > > Review request for ranger and Abhay Kulkarni. > > > Bugs: RANGER-3292 > https://issues.apache.org/jira/browse/RANGER-3292 > > > Repository: ranger > > > Description > ------- > > The root cause is `runnables` get increased when runnable is executing. It > can be fixed by using index instead of foreach. > > > Diffs > ----- > > > security-admin/src/main/java/org/apache/ranger/common/db/RangerTransactionSynchronizationAdapter.java > 7349898e7 > > security-admin/src/test/java/org/apache/ranger/common/db/TestRangerTransactionSynchronizationAdapter.java > PRE-CREATION > > > Diff: https://reviews.apache.org/r/73365/diff/2/ > > > Testing > ------- > > `mvn clean test` pass on my local and the error does not appear on my local. > > > Thanks, > > Chia-Ping Tsai > >
