soarez commented on pull request #10650: URL: https://github.com/apache/kafka/pull/10650#issuecomment-846301061
@kowshik I'm not sure it is surprising. The `NoSuchElementException` is thrown from the scheduled task `kafka-log-start-offset-checkpoint` - see original stack trace - which runs in a separate thread, and as far as I can see there is no synchronization logic to ensure that it won't access segments between the `segments.clear()` I pointed out, and the subsequent lines you refer to. There a time window there were the segments are actually empty. There is an initial delay on the scheduled task of 30 seconds. I'm guessing that initial delay is there to let all the logs load up and recover correctly. But if there are a lot of logs to recover - like in the case of an inactive broker coming back after a long time in a busy cluster - that may not be enough. -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org