pinpoint-apm/pinpoint · error · java.lang.IllegalStateException
IllegalStateException
Error message
IllegalStateException
What it means
Sentinel guard in the HashEntry iterator's remove() of ConcurrentReferenceHashMap: it fires when remove() is called before next() has ever returned an element, or after remove() has already been invoked for the current element, so there is no valid lastReturned entry to delete. This is standard Iterator contract enforcement, not a data corruption signal. Callers must only call iterator.remove() once per element returned by next().
Source
Thrown at commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/concurrent/jsr166/ConcurrentReferenceHashMap.java:1497
return false;
}
HashEntry<K,V> nextEntry() {
do {
if (nextEntry == null)
throw new NoSuchElementException();
lastReturned = nextEntry;
currentKey = lastReturned.key();
advance();
} while (currentKey == null); // Skip GC'd keys
return lastReturned;
}
public void remove() {
if (lastReturned == null)
throw new IllegalStateException();
ConcurrentReferenceHashMap.this.remove(currentKey);
lastReturned = null;
}
}
final class KeyIterator
extends HashIterator
implements Iterator<K>, Enumeration<K>
{
public K next() { return super.nextEntry().key(); }
public K nextElement() { return super.nextEntry().key(); }
}
final class ValueIterator
extends HashIterator
implements Iterator<V>, Enumeration<V>
{
public V next() { return super.nextEntry().value(); }View on GitHub (pinned to 744c3d3075)
Solutions
- Call next() before each remove()
- Track removal state explicitly if conditional removal is needed
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/concurrent/jsr166/ConcurrentReferenceHashMap.java:1497 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/ccbcf4894d05e685.
Report an issue: GitHub.