smengcl opened a new pull request, #11496:
URL: https://github.com/apache/ozone/pull/11496

   Generated-by: Claude Code (Sonnet 5.5)
   
   ## What changes were proposed in this pull request?
   `BackgroundService.PeriodicalTask#run` called `getTasks()` outside any 
try/catch. The task is scheduled with `scheduleWithFixedDelay`, which silently 
cancels all later executions when a run throws. 
`DirectoryDeletingService#getTasks` iterates the snapshot chain without a lock, 
so a concurrent snapshot purge makes the iterator throw 
`NoSuchElementException`, and the service then never runs again on that OM. 
This is what made 
`TestSnapshotDeletingServiceIntegrationTest#testSnapshotWithFSO` time out 
waiting for deep cleaning.
   
   This patch catches `RuntimeException` from `getTasks()`, logs it and retries 
in the next interval, so one bad cycle cannot cancel the schedule of any 
background service. Making the snapshot chain iteration itself race safe is 
left as a follow up.
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/HDDS-16949
   
   ## How was this patch tested?
   Added `TestBackgroundService#testServiceKeepsRunningAfterGetTasksThrows`, 
where `getTasks()` throws on the first call. It fails with a timeout without 
the fix and passes with it. `TestBackgroundService` (3 tests) and checkstyle 
pass locally.
   - 10x10 
[flaky-test-check](https://github.com/smengcl/hadoop-ozone/actions/runs/38289721972)
 on this branch: in progress
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to