Repository navigation
refactor: centralize thread-local cleanup into ThreadLocalCleaner - #1260
bengbengbalabalabeng wants to merge 2 commits into
Conversation
skytin1004
left a comment
There was a problem hiding this comment.
I pulled the latest head and reproduced a concurrency failure in the new registry. While one thread was iterating cleanTasks in clearAllThreadLocals(), I registered another cleaner from a second thread. The finishing thread threw ConcurrentModificationException.
Because finish() now calls this registry directly, a successful read or write can fail during cleanup when another thread lazily initializes a utility class and registers its cleaner. Please make registration and iteration thread-safe, for example with CopyOnWriteArrayList or an immutable snapshot under synchronization, and add a deterministic concurrency regression test.
Thanks for the review! I've switched the list to |
Purpose of the pull request
What's changed?
Checklist