dataroaring opened a new pull request, #62061: URL: https://github.com/apache/doris/pull/62061
## Summary - `BDBEnvironment.close()` iterates `openedDatabases` without acquiring `lock.writeLock()` - `openDatabase()` concurrently modifies the same `ArrayList` under the write lock - When the replayer thread catches `RollbackException` and calls `close()`, while HTTP/heartbeat/RPC handler threads call `openDatabase()` via `getMaxJournalId()`, `ConcurrentModificationException` is thrown - This kills the replayer thread, causing the follower FE to fall permanently behind the master **Race scenario:** 1. **Thread A (Replayer)**: catches `RollbackException` in `getDatabaseNames()`, calls `bdbEnvironment.close()` which iterates `openedDatabases` **without** the write lock 2. **Thread B (HTTP handler)**: calls `getMaxJournalId()` → `openDatabase()` → `openedDatabases.add(db)` **with** the write lock 3. Thread A's for-each iterator detects structural modification → `ConcurrentModificationException` Fix: wrap the entire `close()` body with `lock.writeLock()` to mutually exclude with `openDatabase()` and `removeDatabase()`. ## Test plan - [ ] Verify follower FE handles RollbackException recovery correctly - [ ] Verify `SHOW FRONTENDS` works concurrently with journal operations - [ ] Verify no ConcurrentModificationException in FE logs during role transitions 🤖 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]
