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
In a multithreaded environment, when using giveMeOne, ConcurrentModificationException and JqwikException exceptions will occur.
Your environment
Fixture Monkey 1.0.21
Java 17
Steps to reproduce
` @test
public void test() throws Exception {
CountDownLatch latch = new CountDownLatch(100);
CountDownLatch mLatch = new CountDownLatch(100);
for (int i = 0; i < 100; i++) {
final Integer ii = i;
new Thread(() -> {
try {
latch.await();
FixtureMonkey fixtureMonkey = FixtureMonkey.builder().defaultNotNull(true).objectIntrospector(FieldReflectionArbitraryIntrospector.INSTANCE).build();
System.out.println(ii + JSON.toJSONString(fixtureMonkey.giveMeOne(tt.class)));
} catch (Exception e) {
e.printStackTrace();
} finally {
mLatch.countDown();
}
}).start();
latch.countDown();
}
mLatch.await();
}
@Data
public static class tt {
public String name;
}`
Expected behaviour
Running normally.
Actual behaviour
java.util.ConcurrentModificationException at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1221) at net.jqwik.engine.execution.lifecycle.StoreRepository.addStore(StoreRepository.java:56) at net.jqwik.engine.execution.lifecycle.StoreRepository.create(StoreRepository.java:51) at net.jqwik.engine.facades.StoreFacadeImpl.create(StoreFacadeImpl.java:19) at net.jqwik.api.lifecycle.Store.create(Store.java:67)
and net.jqwik.api.JqwikException: You cannot create Store(net.jqwik.engine.facades.Memoize, PROPERTY, [jqwik:samples]): [null] with identifier [class net.jqwik.engine.facades.Memoize]. It conflicts with existing Optional[Store(net.jqwik.engine.facades.Memoize, PROPERTY, [jqwik:samples]): [{}]] at net.jqwik.engine.execution.lifecycle.StoreRepository.lambda$addStore$2(StoreRepository.java:72) at java.base/java.util.Optional.ifPresent(Optional.java:178) at net.jqwik.engine.execution.lifecycle.StoreRepository.addStore(StoreRepository.java:65) at net.jqwik.engine.execution.lifecycle.StoreRepository.create(StoreRepository.java:51) at net.jqwik.engine.facades.StoreFacadeImpl.create(StoreFacadeImpl.java:19)
The text was updated successfully, but these errors were encountered:
Describe the bug
In a multithreaded environment, when using giveMeOne, ConcurrentModificationException and JqwikException exceptions will occur.
Your environment
Steps to reproduce
` @test
public void test() throws Exception {
CountDownLatch latch = new CountDownLatch(100);
CountDownLatch mLatch = new CountDownLatch(100);
for (int i = 0; i < 100; i++) {
final Integer ii = i;
new Thread(() -> {
try {
latch.await();
FixtureMonkey fixtureMonkey = FixtureMonkey.builder().defaultNotNull(true).objectIntrospector(FieldReflectionArbitraryIntrospector.INSTANCE).build();
System.out.println(ii + JSON.toJSONString(fixtureMonkey.giveMeOne(tt.class)));
} catch (Exception e) {
e.printStackTrace();
} finally {
mLatch.countDown();
}
}).start();
latch.countDown();
}
mLatch.await();
}
Expected behaviour
Running normally.
Actual behaviour
java.util.ConcurrentModificationException at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1221) at net.jqwik.engine.execution.lifecycle.StoreRepository.addStore(StoreRepository.java:56) at net.jqwik.engine.execution.lifecycle.StoreRepository.create(StoreRepository.java:51) at net.jqwik.engine.facades.StoreFacadeImpl.create(StoreFacadeImpl.java:19) at net.jqwik.api.lifecycle.Store.create(Store.java:67)
and
net.jqwik.api.JqwikException: You cannot create Store(net.jqwik.engine.facades.Memoize, PROPERTY, [jqwik:samples]): [null] with identifier [class net.jqwik.engine.facades.Memoize]. It conflicts with existing Optional[Store(net.jqwik.engine.facades.Memoize, PROPERTY, [jqwik:samples]): [{}]] at net.jqwik.engine.execution.lifecycle.StoreRepository.lambda$addStore$2(StoreRepository.java:72) at java.base/java.util.Optional.ifPresent(Optional.java:178) at net.jqwik.engine.execution.lifecycle.StoreRepository.addStore(StoreRepository.java:65) at net.jqwik.engine.execution.lifecycle.StoreRepository.create(StoreRepository.java:51) at net.jqwik.engine.facades.StoreFacadeImpl.create(StoreFacadeImpl.java:19)
The text was updated successfully, but these errors were encountered: