Skip to content

Conversation

@avpotapov00
Copy link
Contributor

@avpotapov00 avpotapov00 commented Aug 2, 2023

Closes #219 #218 and adds recursive spin-locks support.

Subtasks:

  • Rebase on develop with javaagent 2d
  • Code review 3d

@avpotapov00 avpotapov00 requested a review from ndkoval August 2, 2023 22:53
@avpotapov00 avpotapov00 self-assigned this Aug 2, 2023
@avpotapov00 avpotapov00 changed the base branch from master to develop August 2, 2023 22:53
Aleksandr.Potapov added 4 commits August 3, 2023 00:55
…on-enhancements

# Conflicts:
#	src/jvm/main/org/jetbrains/kotlinx/lincheck/runner/InvocationResult.kt
#	src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/InterleavingSequenceTrackableSet.kt
#	src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/ManagedStrategy.kt
#	src/jvm/main/org/jetbrains/kotlinx/lincheck/strategy/managed/modelchecking/ModelCheckingStrategy.kt
#	src/jvm/test/org/jetbrains/kotlinx/lincheck_test/representation/SpinlockEventsCutTests.kt
#	src/jvm/test/resources/expected_logs/switch_in_the_middle_of_spin_cycle_causes_error.txt
Copy link
Collaborator

@ndkoval ndkoval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is an intermediate review. I need to switch to java agents now; after that, I'll finish the review.

api("org.ow2.asm:asm-commons:$asmVersion")
api("org.ow2.asm:asm-util:$asmVersion")
api("org.reflections:reflections:$reflectionsVersion")
api("net.sf.trove4j:trove4j:3.0.3")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please repackage it to org.jetbrains.kotlinx.lincheck


package org.jetbrains.kotlinx.lincheck.strategy.managed;

public class TrackMethodsFlagHolder {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rewrite to Kotlin


package org.jetbrains.kotlinx.lincheck.strategy.managed;

public class TrackMethodsFlagHolder {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you use it only when detecting spin locks?

className.equals(kotlinx.coroutines.CoroutineExceptionHandler.class.getName()) ||
className.equals(kotlinx.coroutines.CoroutineDispatcher.class.getName());
className.equals(kotlinx.coroutines.CoroutineDispatcher.class.getName()) ||
className.equals(TrackMethodsFlagHolder.class.getName());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly to other Lincheck classes, it should not be transformed by default

}

fun rollbackAfterSpinCycleFound() {
lastNotInitializedNode = initialLastNotInitializedNode
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change related to another bug?

cycleExecutionsHash: Int,
): InterleavingHistoryNode {
check(executions >= executionsBeforeCycle)
check(executions >= executionsBeforeCycle) { "?" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace "?" with a meaningful message

if (startIndex > newChain.lastIndex) return
val firstNewNode = newChain[startIndex]
val firstNewNodeExecutions = (firstNewNode.executions + firstNewNode.spinCyclePeriod) - executionsCountedEarlier
val firstNewNodeExecutions =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the formatting

cycleOccurred = cycleOccurred,
cycleLocationsHash = cycleLocationsHash
cycleLocationsHash = cycleLocationsHash,
executionsBeforeSpinCycleWithAdditionalEvents = executionsBeforeSpinCycleWithAdditionalEvents
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shorten the parameter name

it.cycleOccurred && executionsCount == it.executions
} ?: false

val executionsBeforeSpinCycleWithAdditionalEvents: Int get() = currentNode!!.executionsBeforeSpinCycleWithAdditionalEvents
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document

} else CycleInfo(
minLastPositionNotRelatedToCycle + 1,
targetCycleLength
) // number of prefix elements with first cycle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the comment in the correct place?

@ndkoval
Copy link
Collaborator

ndkoval commented Jul 9, 2024

The changes will be delivered under #331

@ndkoval ndkoval closed this Jul 9, 2024
@ndkoval ndkoval deleted the spin-locks-detection-enhancements branch July 9, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants