#3359 fix: ConcurrentModificationException regression in schema getTypes()#3590
#3359 fix: ConcurrentModificationException regression in schema getTypes()#3590
Conversation
…ntModificationException The regression from 9959c82 ("remove duplicates from types returned") exposed a race condition: getTypes() iterates over a live HashMap.values() view, which throws ConcurrentModificationException when another thread modifies the schema concurrently. Switching to ConcurrentHashMap provides weakly-consistent iterators that are safe for concurrent reads. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a concurrency regression by making the schema's type storage thread-safe. It prevents Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🧪 CI InsightsHere's what we observed from your CI run for d1b4d56. 🟢 All jobs passed!But CI Insights is watching 👀 |
Code ReviewSummaryThis is a clean, minimal fix for a real concurrency regression. The approach is correct and consistent with existing patterns in the class. Positive AspectsConsistency with existing patterns — Minimal change — Only the necessary line is touched, and deduplication via Good regression test — Minor ObservationsWeakly-consistent iteration semantics (acceptable, worth a comment)
The method is Test placement
Other maps in the same class
Bottom LineThe fix is correct, targeted, and consistent with existing code. The regression test is well-constructed. The observations above are all minor; none of them block merging. |
There was a problem hiding this comment.
Code Review
This pull request addresses a ConcurrentModificationException regression in LocalSchema.getTypes() by changing the types map from a HashMap to a ConcurrentHashMap. This change is correct, as ConcurrentHashMap is designed for concurrent access and its iterators do not throw ConcurrentModificationException. The fix is minimal and effectively resolves the described issue without affecting other logic.
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3590 +/- ##
==========================================
- Coverage 65.81% 65.01% -0.81%
==========================================
Files 1514 1514
Lines 103683 103683
Branches 21457 21457
==========================================
- Hits 68239 67408 -831
- Misses 26193 27098 +905
+ Partials 9251 9177 -74 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
9959c82("remove duplicates from types returned") introduced a regression whereLocalSchema.getTypes()wrapsHashMap.values()in aLinkedHashSet, iterating over a live view that throwsConcurrentModificationExceptionwhen another thread modifies the schema concurrentlytypesmap fromHashMaptoConcurrentHashMap, whose iterators are weakly consistent and safe for concurrent readsTest plan
Issue3359Testpasses (concurrent read queries with schema modification)SchemaTestpasses (7 tests)🤖 Generated with Claude Code