Re: Node hangs while accessing cache from Compute Task

2017-02-22 Thread GB
Thanks Dmitry.



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Node-hangs-while-accessing-cache-from-Compute-Task-tp10637p10790.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Node hangs while accessing cache from Compute Task

2017-02-16 Thread Gaurav Bajaj
Hi Dmitry,

Thanks for the detailed explanation.

Do you know if this behavior "It's not allowed to use cache API in
CacheEntryProcessor, query listeners, interceptors and so forth, because it
leads to deadlocks" is documented somewhere?


Thanks,
Gaurav


On Thu, Feb 16, 2017 at 12:16 PM, dkarachentsev <dkarachent...@gridgain.com>
wrote:

> Hi,
>
> This is a correct behavior. It's not allowed to use cache API in
> CacheEntryProcessor, query listeners, interceptors and so forth, because it
> leads to deadlocks. In your example it looks like (threads T1, T2):
> T1 put entry -> T1 lock entry -> T1 call listener -> T1 execute job -> T1
> wait for result -> T2 get entry -> T2 try to lock entry -> T2 BLOCKED by T1
>
> @IgniteAsyncCallback is a legal way to resolve such situations. In your
> case
> it will be:
> T1 put entry -> T1 lock entry -> T1 submit listener to callback pool -> T1
> unlock entry.
> T3 - callback thread.
> T3 execute job -> T3 wait for result -> T2 get entry -> T2 lock entry -> T2
> unlock entry -> T2 return compute result -> T3 release with result.
>
> No deadlocks now.
>
> -Dmitry.
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Node-hangs-while-accessing-cache-from-Compute-Task-
> tp10637p10668.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>


Re: Node hangs while accessing cache from Compute Task

2017-02-16 Thread dkarachentsev
Hi,

This is a correct behavior. It's not allowed to use cache API in
CacheEntryProcessor, query listeners, interceptors and so forth, because it
leads to deadlocks. In your example it looks like (threads T1, T2):
T1 put entry -> T1 lock entry -> T1 call listener -> T1 execute job -> T1
wait for result -> T2 get entry -> T2 try to lock entry -> T2 BLOCKED by T1

@IgniteAsyncCallback is a legal way to resolve such situations. In your case
it will be:
T1 put entry -> T1 lock entry -> T1 submit listener to callback pool -> T1
unlock entry.
T3 - callback thread.
T3 execute job -> T3 wait for result -> T2 get entry -> T2 lock entry -> T2
unlock entry -> T2 return compute result -> T3 release with result.

No deadlocks now.

-Dmitry.



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Node-hangs-while-accessing-cache-from-Compute-Task-tp10637p10668.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.