You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a HeapInstance, calling readFields().any() in two threads simultaneous results in this error:
Exception in thread "Thread-0" java.util.NoSuchElementException: Key 0 is missing in the map.
at kotlin.collections.MapsKt__MapWithDefaultKt.getOrImplicitDefaultNullable(MapWithDefault.kt:24)
at kotlin.collections.MapsKt__MapsKt.getValue(Maps.kt:344)
at shark.internal.ClassFieldsReader.skipStaticFields(ClassFieldsReader.kt:87)
at shark.internal.ClassFieldsReader.classDumpFields(ClassFieldsReader.kt:55)
at shark.HprofHeapGraph.classDumpFields$shark_graph(HprofHeapGraph.kt:207)
at shark.HeapObject$HeapClass.readRecordFields(HeapObject.kt:259)
at shark.HeapObject$HeapInstance$readFields$1.invoke(HeapObject.kt:450)
at shark.HeapObject$HeapInstance$readFields$1.invoke(HeapObject.kt:315)
at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:315)
at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303)
at kotlin.sequences.SequencesKt___SequencesKt.any(_Sequences.kt:1179)
ClassFieldsReader holds the metadata for all class fields as one giant immutable byte array, so that's thread safe. However, it has a var position that is reset every time we read fields from one class and then moves forward as we read. We need to make that thread safe.
Description
Given a
HeapInstance
, callingreadFields().any()
in two threads simultaneous results in this error:Steps to Reproduce
Sample project.
Run
./gradlew run
to repro.Expected behavior: [What you expect to happen]
Version Information
Shark 2.6.
The text was updated successfully, but these errors were encountered: