Draft
Conversation
eupp
requested changes
Jan 18, 2026
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/LoopDetector.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/LoopDetector.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/LoopDetector.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/LoopDetector.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/LoopDetector.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/LoopDetector.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/LoopDetector.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/LoopDetector.kt
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
89c7c33 to
686a7be
Compare
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
8c64d72 to
c41ab92
Compare
…StartTracePoint is not added to the trace, but LoopEndTracePoint is, so the iterations are not grouped together
eupp
reviewed
Feb 1, 2026
src/jvm/main/org/jetbrains/kotlinx/lincheck/trace/TraceNodes.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/trace/TraceNodes.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/trace/TraceNodes.kt
Outdated
Show resolved
Hide resolved
| methodName = "run", | ||
| methodType = Types.MethodType(Types.VOID_TYPE) | ||
| ) | ||
| popMethodId(currentThreadId, methodId) |
Collaborator
There was a problem hiding this comment.
Let's instead add methods to loop detector:
fun beforeThreadRun(...)
fun afterThreadRun(...)
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Outdated
Show resolved
Hide resolved
src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
Show resolved
Hide resolved
…agedStrategy.kt independent of the loop detection algorithm
* Fix a subtle bug involving checks for package names that were shadowed and re-located. The shadow jar plugin substitutes all string literals in the source code that contain names of relocated packages. So special care is required when performing checks against names of relocated packages. * Thanks to @dmitrii-artuhov for a clever hack on how to circumvent package shadowing in strings. Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
…tBrains#942) Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
--------- Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
--------- Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
…ains#948) --------- Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com> Co-authored-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
--------- Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Re-creation of two hash sets on each call can be accounted for generation 50% of memory allocations in reading trace.
…ail on exceptions (JetBrains#956)
…RecursiveSpinLockTwoStepRecursionEventsTest
…kip the loop detector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@eupp
This PR contains the basic LoopDetector API. A small description:
For the moment, I've made the LoopDetector maintain a per thread state image with the next ideas:
For a thread when first entering a loop, we either create a dummy frame or use the one we are in and push a new ActiveLoop onto it. During the other iterations of the loop, the methodIds are verified to match, the counter is increased and the thresholds are verified. When finishing a loop it removes the ActiveLoop from the stack.
On method level, we verify the top method on the stack, and if it matches with the current methodId it means we encounter some recursion, so the depth counter is incremented. If the depth > threshold then for the time being we declare the loop as stuck and try to switch the thread. On method exit we either decrease the depth or we remove the method from the stack (depth is 0)