Questions tagged [jcstress]
10 questions
18
votes
1 answer
Confused by jcstress test on ReentrantReadWriteLock#tryLock failing
I am trying to get to grips with JCStress. To ensure I understand it, I decided to write some simple tests for something that I know must be correct: java.util.concurrent.locks.ReentrantReadWriteLock.
I wrote some very simple tests to check lock…

adamretter
- 3,885
- 2
- 23
- 43
3
votes
3 answers
Does final field guarantee the field values to be visible in a different thread?
I am using JCStress to test for the final variable. I know that final can be used to make sure that when you construct an object, another thread accessing that object doesn't see that object in a partially constructed state.
Now I have a class…

Mohendra Amatya
- 371
- 6
- 24
2
votes
2 answers
Running first JCStress test
I'm new to JCStress and I'm trying to run the "hello world" for JCStress but facing some problems. I think there is some obvious thing that I'm missing.
I'm following this link to learn. And the samples that I'm trying are here.
I started with the…

Lavish Kothari
- 2,211
- 21
- 29
1
vote
1 answer
Can JCStress outcome can be described as the result of caching instead of reordering?
I modified one of JCStress examples:
@JCStressTest
@Outcome(id = "0, 0", expect = ACCEPTABLE, desc = "Doing both reads early.")
@Outcome(id = "1, 1", expect = ACCEPTABLE, desc = "Doing both reads late.")
@Outcome(id = "1, 0", expect = ACCEPTABLE,…

Piotr Michalczyk
- 249
- 1
- 13
1
vote
0 answers
Does the program remain correct when I drop one of two volatiles?
I've got this simplified code snippet with two volatiles (assume we must keep both fields):
volatile boolean hasParam;
volatile String param;
boolean hasParam() {
if (param == null) {
getParam();
}
return hasParam;
}
String getParam() {
…

Sergey Tsypanov
- 3,265
- 3
- 8
- 34
1
vote
1 answer
JCStress - strange volatile and static keyword behavior
I have this simple Jcstress test:
package io.denery;
import org.openjdk.jcstress.annotations.*;
import org.openjdk.jcstress.infra.results.IIII_Result;
@JCStressTest
@Outcome(expect = Expect.ACCEPTABLE_INTERESTING)
@State
public class RaceIRIWTest…

ExtraExtremeERA
- 53
- 6
1
vote
1 answer
How can I produce instruction reordering in jcstress test
When I am suspicious certain instruction reordering is allowed by the java language specification, I want to reproduce it in a jcstress test. How can I do that? For example, in the following code, the Load and Store instructions (I believe) are…

user675693
- 307
- 1
- 8
1
vote
2 answers
Error during run jcstress: VM option 'StressLCM' is develop and is available only in debug version of VM
I'm trying to run jcstress 0.5, but I'm getting an error:
Error: VM option 'StressLCM' is develop and is available only in debug version of VM.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will…

Andrii Khrupalyk
- 49
- 7
0
votes
2 answers
Can I eliminate nested synchronized on a private field within synchronized method
I've got this legacy pseudocode:
public class Wrapper {
private volatile Sink sink;
public synchronized void flushSink() {
if (sink != null) {
synchronized (sink) {
sink.flush();
}
}
}
public void close() …

Sergey Tsypanov
- 3,265
- 3
- 8
- 34
0
votes
1 answer
faile in using jcstress due to tests can't be found
I try to use jcstress to do some test in IDEA
and here is the configuration in IDEA
the code is not the point, but i will post it anyway
@JCStressTest
@Outcome(id={"1","4"},expect = Expect.ACCEPTABLE,desc="ok")
@Outcome(id="0",expect =…

MMMMMCCLXXVII
- 571
- 1
- 8
- 23