Well, that’s diving a bit deeper than the “don’t do cache operations” rule of 
thumb, but let’s do that.

When receiver is invoked for key K, it’s holding the lock for K.
It is safe to do invoke on that K (especially if you control the invoked code) 
since it is locked already.
But it is not safe to call invoke on another key J – because someone holding 
the lock for J might be doing the same for K, leading to a deadlock.

I believe it is really awkward to micromanage these locks, so the best practice 
is to avoid starting any cache operations (or, more general, any locking 
operations – including put()/get()) from the system pool threads, i.e. when 
executing things like StreamReceiver, Coninious Query listener, invoke() 
closure, etc – basically anything that is intercepting a cache operation.

Thanks,
Stan

From: breischl
Sent: 22 июня 2018 г. 18:09
To: [email protected]
Subject: RE: Deadlock during cache loading

Hi Stan,
  Thanks for taking a look. I'm having trouble finding anywhere that it's
documented what I can or can't call inside a receiver. Is it just
put()/get() that are allowed? 

  Also, I noticed that the default StreamTransformer implementation calls
invoke() from within a receiver. So is that broken/deadlock-prone as well?

https://github.com/apache/ignite/blob/master/modules/core/src/main/java/org/apache/ignite/stream/StreamTransformer.java#L50-L53

Thanks!
BKR



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to