[jira] [Commented] (IGNITE-8547) Deserialization of Enum values as anonymous classes may cause deadlock

2018-05-25 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on IGNITE-8547:


Github user asfgit closed the pull request at:

https://github.com/apache/ignite/pull/4063


> 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 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)


[jira] [Commented] (IGNITE-8547) Deserialization of Enum values as anonymous classes may cause deadlock

2018-05-25 Thread Valentin Kulichenko (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-8547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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 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)


[jira] [Commented] (IGNITE-8547) Deserialization of Enum values as anonymous classes may cause deadlock

2018-05-25 Thread Ilya Kasnacheev (JIRA)

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

Ilya Kasnacheev commented on IGNITE-8547:
-

[~vkulichenko] pls merge to master if possible after review.

> 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 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)


[jira] [Commented] (IGNITE-8547) Deserialization of Enum values as anonymous classes may cause deadlock

2018-05-25 Thread Ilya Kasnacheev (JIRA)

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

Ilya Kasnacheev commented on IGNITE-8547:
-

[~slukyanov] please review amended fix, answer if it's OK now

> 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 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)


[jira] [Commented] (IGNITE-8547) Deserialization of Enum values as anonymous classes may cause deadlock

2018-05-24 Thread Ilya Kasnacheev (JIRA)

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

Ilya Kasnacheev commented on IGNITE-8547:
-

[~slukyanov] please review proposed fix!

> 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 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)


[jira] [Commented] (IGNITE-8547) Deserialization of Enum values as anonymous classes may cause deadlock

2018-05-24 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on IGNITE-8547:


GitHub user alamar opened a pull request:

https://github.com/apache/ignite/pull/4063

IGNITE-8547 Use JVM serialization for enum values with OptimizedMarsh…

…aller, avoid deadlock.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/gridgain/apache-ignite ignite-8547

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/ignite/pull/4063.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #4063


commit 4ddb8bd85c7000356badb7bd8daf233491aaa3bf
Author: Ilya Kasnacheev 
Date:   2018-05-22T11:32:12Z

IGNITE-8547 Use JVM serialization for enum values with OptimizedMarshaller, 
avoid deadlock.




> 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
>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 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)


[jira] [Commented] (IGNITE-8547) Deserialization of Enum values as anonymous classes may cause deadlock

2018-05-24 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on IGNITE-8547:


Github user alamar closed the pull request at:

https://github.com/apache/ignite/pull/4042


> 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
>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 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)


[jira] [Commented] (IGNITE-8547) Deserialization of Enum values as anonymous classes may cause deadlock

2018-05-23 Thread Ilya Kasnacheev (JIRA)

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

Ilya Kasnacheev commented on IGNITE-8547:
-

[~vkulichenko] in Binary marshaller, the issue was fixed with IGNITE-5087. I'm 
adding the test which tries all 3 of them (JDK, Bin, Opt)

> 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
>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 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)


[jira] [Commented] (IGNITE-8547) Deserialization of Enum values as anonymous classes may cause deadlock

2018-05-22 Thread Valentin Kulichenko (JIRA)

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

Valentin Kulichenko commented on IGNITE-8547:
-

[~ilyak], if it's about legacy {{OptimizedMarshaller}}, I'm OK with both 
options. JDK seems to be easier to implement and more reliable.

However, I'm concerned about {{BinaryMarshaller}} - does the issue exist there 
as well?

> 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
>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 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)


[jira] [Commented] (IGNITE-8547) Deserialization of Enum values as anonymous classes may cause deadlock

2018-05-21 Thread Ilya Kasnacheev (JIRA)

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

Ilya Kasnacheev commented on IGNITE-8547:
-

There's at least two approaches. Both involve fixing 
OptimizedObjectOutputStream.write0.

Approach 1:
{code}
if (obj instanceof Throwable && !(obj instanceof Externalizable) || 
BinaryUtils.isEnum(obj.getClass())) {
   writeByte(JDK);
   // Just let the JDK serialize our enum.
{code}

Approach 2:
{code}
Class cls;

if (obj instanceof Object[])
cls = Object[].class;
else if (BinaryUtils.isEnum(obj.getClass()))
cls = ((Enum)obj).getDeclaringClass();
else
cls = obj.getClass();

OptimizedClassDescriptor desc = classDescriptor(clsMap, cls, 
ctx, mapper);
{code}

Use declaring class for enum, hope that it gets interpreted correctly on the 
other side (looks like it does)

[~vkulichenko] I would love to hear your input on this one.

> 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
>Assignee: Ilya Kasnacheev
>Priority: Major
> 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 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)


[jira] [Commented] (IGNITE-8547) Deserialization of Enum values as anonymous classes may cause deadlock

2018-05-21 Thread Ilya Kasnacheev (JIRA)

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

Ilya Kasnacheev commented on IGNITE-8547:
-

This problem is also present in master.

> 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
>Assignee: Ilya Kasnacheev
>Priority: Major
> 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 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)


[jira] [Commented] (IGNITE-8547) Deserialization of Enum values as anonymous classes may cause deadlock

2018-05-21 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on IGNITE-8547:


GitHub user alamar opened a pull request:

https://github.com/apache/ignite/pull/4042

IGNITE-8547 Use JVM serialization for enum values with OptimizedMarshaller

.., avoid deadlock.

Also IGNITE-5087 Enum comparison fails after marshal-unmarshal with 
BinaryMarshaller.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/gridgain/apache-ignite ignite-8547

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/ignite/pull/4042.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #4042


commit beb2409cfe2045789443d47de735d879961d371e
Author: Andrey V. Mashenkov 
Date:   2017-06-23T09:26:06Z

GG-12352: Forcible node drop makes cluster instable in some cases.
Disable forcible node drop by default.

commit 802f18fc250cbae8959192c78bb28dc525ed3cf7
Author: AMRepo 
Date:   2017-06-22T21:24:57Z

Fix compilation

commit 39d2dec85a3c571dfdb1cd6189b53ae2413a5d22
Author: Andrey V. Mashenkov 
Date:   2017-06-23T10:41:30Z

Merge branch 'ignite-1.7.12-b2' into ignite-1.8.8

# Conflicts:
#   modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
#   
modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
#   
modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
#   
modules/core/src/main/java/org/apache/ignite/internal/managers/communication/IgniteIoTestMessage.java
#   
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
#   
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
#   
modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
#   
modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskThreadContextKey.java
#   
modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
#   
modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java

commit 96445156143b46b664f785b353463dd435ac342d
Author: Andrey V. Mashenkov 
Date:   2017-06-23T10:42:44Z

Merge remote-tracking branch 'origin/ignite-1.8.8' into ignite-1.8.8

# Conflicts:
#   
modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java

commit 7c569f15a80ab9301c21011d2c9159e311e46cef
Author: Andrey V. Mashenkov 
Date:   2017-06-23T10:48:10Z

Merge remote-tracking branch 'origin/ignite-1.8.7.p1' into ignite-1.8.8

commit a64339449be8fa602cab3f2868c5f74004a7b747
Author: Igor Sapego 
Date:   2017-06-23T13:57:49Z

IGNITE-4370: Implemented writing of batch of parameters for ODBC.

(cherry picked from commit c10be5780589cc84e7929e234e4411d515166e0b)
(cherry picked from commit d268b32cb252a5f06887d2b803d27ddc20ded95f)

commit cbe5df51c423568782e31245c7f1aa06c9ba3be1
Author: Igor Sapego 
Date:   2017-06-13T16:47:00Z

IGNITE-5478: ODBC: SQLNumParams now returns number of required parameters.

(cherry picked from commit b1c56a1)

(cherry picked from commit 4a8f295)

commit 9ad513e68b89e907f7db36a3f3f0daca0e5986e6
Author: Igor Sapego 
Date:   2017-06-23T14:06:40Z

IGNITE-5478: Fix for cherry pick

(cherry picked from commit a2a4ec1ee9794cb542f146a07c6c67002cad444e)

commit bfec212b1ece0e9e791de6dfb642324834fa77ca
Author: AMRepo 
Date:   2017-06-22T21:24:57Z

Partially reverted GG-12352.

commit 1abc14fdc4e39d8245c3e50fb2cf3d183df08021
Author: AMRepo 
Date:   2017-06-22T21:24:57Z

Partially reverted GG-12352.

commit cb95f7aa729fda19b4c3b7a5ada903a1e1bc2eab
Author: Andrey V. Mashenkov 
Date:   2017-06-23T16:08:00Z

Merge remote-tracking branch 'origin/ignite-1.7.12' into ignite-1.7.12

commit f59007f2c1221d8dd22abb0a9692b4abb31e87ad
Author: AMRepo 
Date:   2017-06-22T21:24:57Z

Partially reverted GG-12352.

commit 2c7d3c03cd36aee4f0985e674f550a62fc64d2db
Author: Andrey V. Mashenkov 
Date:   2017-06-23T17:11:00Z

Merge branch 'ignite-1.8.8' into ignite-1.9.4

# Conflicts:
#   
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
#   

[jira] [Commented] (IGNITE-8547) Deserialization of Enum values as anonymous classes may cause deadlock

2018-05-21 Thread Ilya Kasnacheev (JIRA)

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

Ilya Kasnacheev commented on IGNITE-8547:
-

It seems that, for Binary Marshaller, this behavior were fixed by IGNITE-5087.

> 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
>Assignee: Ilya Kasnacheev
>Priority: Major
> 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 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)