ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Valentin Kulichenko (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IGNITE-8547) Deserialization of Enum values as anonymous classes may cause deadlock
Date Fri, 25 May 2018 21:26:00 GMT

    [ https://issues.apache.org/jira/browse/IGNITE-8547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16491284#comment-16491284
] 

Valentin Kulichenko commented on IGNITE-8547:
---------------------------------------------

[~ilyak], merged changes to master. Thanks for the contribution!

> 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, 2.5
>            Reporter: Ilya Kasnacheev
>            Assignee: Ilya Kasnacheev
>            Priority: Major
>              Labels: test
>         Attachments: MarshallerDeadlockMultiJvmTest.java
>
>
> 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)

Mime
View raw message