You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Ilya Kasnacheev (JIRA)" <ji...@apache.org> on 2018/05/21 16:25:00 UTC
[jira] [Created] (IGNITE-8547) Deserialization of Enum values as
anonymous classes may cause deadlock
Ilya Kasnacheev created IGNITE-8547:
---------------------------------------
Summary: Deserialization of Enum values as anonymous classes may cause deadlock
Key: IGNITE-8547
URL: https://issues.apache.org/jira/browse/IGNITE-8547
Project: Ignite
Issue Type: Bug
Affects Versions: 1.9
Reporter: Ilya Kasnacheev
Due to the following problem:
{code}
package jvmtest;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
public class LegTypeTest {
public static void main(String[] args) throws InterruptedException, BrokenBarrierException {
List<Thread> threadList = new ArrayList<>();
CyclicBarrier b1 = new CyclicBarrier(16);
CyclicBarrier b2 = new CyclicBarrier(17);
for (int i = 0; i < 16; i++) {
final int ii = i;
Thread thread = new Thread(() -> {
try {
b1.await();
if (ii % 2 == 0)
Class.forName("jvmtest.LegTypeTest$E$1");
if (ii % 2 == 1)
Class.forName("jvmtest.LegTypeTest$E");
b2.await();
} catch (Exception e) {
e.printStackTrace();
}
});
thread.start();
threadList.add(thread);
}
b2.await();
for (Thread thread : threadList) {
thread.join();
}
}
private enum E {
A("A"),
B("B") {
@Override
public String virtual() {
return null;
}
};
private String displayString;
E(String displayString) {
this.displayString = displayString;
}
public String virtual() {
return displayString;
}
}
}
{code}
When doing Class.forName on different enum values deadlock can be caused. And that's exactly what OptimizedMarshaller does.
See also the attached test.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)