Describe the bug
See the reproduction. It will deadlock. The problem seems (at least to me) to be in MockInteraction - there is a write lock that is acquired in accept and that causes the deadlock.
To Reproduce
class Foo {
void bar() {
}
}
...
def called = false
def foo
foo = Mock(Foo) {
bar() >> {
if (!called) {
called = true
Thread.start { foo.bar() }.join()
}
}
}
foo.bar()
Expected behavior
No deadlock
Actual behavior
Deadlock
Java version
21.0.2
Buildtool version
Gradle 8.6
What operating system are you using
Linux
Dependencies
Only Spock.
Additional context
Ported from #1882 (comment)
cc @leonard84
Describe the bug
See the reproduction. It will deadlock. The problem seems (at least to me) to be in
MockInteraction- there is a write lock that is acquired inacceptand that causes the deadlock.To Reproduce
Expected behavior
No deadlock
Actual behavior
Deadlock
Java version
21.0.2
Buildtool version
Gradle 8.6
What operating system are you using
Linux
Dependencies
Only Spock.
Additional context
Ported from #1882 (comment)
cc @leonard84