You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Prasad Bhalerao <pr...@gmail.com> on 2018/04/19 15:04:05 UTC

Ignite thread state Waiting/blocked

1) As per this link
https://www.gridgain.com/sdk/pe/latest/javadoc/org/apache/ignite/IgniteSpringBean.html
I
used ContextRefreshedEvent to initialize atomic ignite sequence as a spring
bean. But when I do this the thread creating atomic sequence is getting
hunup.

Please check the thread dump as shown below.



public class SubscriptionAtomicSequence implements
ApplicationListener<ContextRefreshedEvent>{

  private static final Logger *LOGGER *=
LoggerFactory.*getLogger*(SubscriptionAtomicSequence.class);

  private IgniteAtomicSequence sequence;
  @Autowired
  private Ignite  ignite;

  public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
    this.sequence=ignite.atomicSequence("subscription",0,true);
  }

  public long getSubscriptionId()
  {
    return sequence.getAndIncrement();
  }









"main@1" prio=5 tid=0x1 nid=NA waiting

  java.lang.Thread.State: WAITING

              at sun.misc.Unsafe.park(Unsafe.java:-1)

              at
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)

              at
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)

              at
java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:997)

              at
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304)

              at
java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231)

              at
org.apache.ignite.internal.util.IgniteUtils.await(IgniteUtils.java:7430)

              at
org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor.awaitInitialization(DataStructuresProcessor.java:1089)

              at
org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor.getAtomic(DataStructuresProcessor.java:496)

              at
org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor.sequence(DataStructuresProcessor.java:372)

              at
org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3537)

              at
org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3526)

              at
org.apache.ignite.IgniteSpringBean.atomicSequence(IgniteSpringBean.java:485)

              at
com.qualys.agms.robot.sequence.SubscriptionAtomicSequence.onApplicationEvent(SubscriptionAtomicSequence.java:27)

              at
com.qualys.agms.robot.sequence.SubscriptionAtomicSequence.onApplicationEvent(SubscriptionAtomicSequence.java:16)

              at
org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)

              at
org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)

              at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)

              at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:399)

              at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:353)

              at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:887)

              at
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:161)

              at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552)

              - locked <0x24ec> (a java.lang.Object)

              at
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)

              at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)

              at
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388)

              at
org.springframework.boot.SpringApplication.run(SpringApplication.java:327)

              at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)

              at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1234)

              at
com.qualys.agms.robot.boot.SpringBootStarter.main(SpringBootStarter.java:16)



2) Is there any better way to create the Ignite atomic sequence as a spring
bean. I did not like the idea of composing the IgniteAtomicSequence in
SubscriptionAtomicSequence class. But I had to do that because Ignite
instance is started after all other Spring beans have been initialized. I
cannot simply write following code, because when this bean is created
ignite is not fully initialized during this time and it throw exception.

@Bean

public  IgniteAtomicSequence subscriptionSequence(){
 return ignite.atomicSequence("subscription",0,true);
}

Re: Ignite thread state Waiting/blocked

Posted by vkulichenko <va...@gmail.com>.
Prasad,

Probably "inherit" term is not a correct one here, and in general I'm not
the biggest Spring expert, sorry :)

What I meant is that if Ignite is declared as a bean, there can be another
bean that depends on Ignite (IgniteAtomicSequence in this case), right? If
Ignite is declared as a bean, and IgniteAtomicSequence is declared as a
bean, latter depending on the former, why your code does not work then?

-Val



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

Re: Ignite thread state Waiting/blocked

Posted by Prasad Bhalerao <pr...@gmail.com>.
Hi,


1) I will send the complete thread dump.

2) I am using IngiteSpringBean to initialize ingite. What I saw is ignite
spring bean wraps ignite instance in it.
So I autowired ignite instead of ingnite spring bean to create atomic
sequence.

But still I did understand your second point "and then inherit other stuff
from it."

Thanks,
Prasad


On Fri, Apr 20, 2018, 1:02 AM vkulichenko <va...@gmail.com>
wrote:

> 1. Can you show full thread dump, not only the thread that creates atomic
> sequence? Also are there any exception on server nodes?
> 2. You can use IgniteSpringBean to initialize Ignite as a bean, and then
> inherit other stuff from it.
>
> -Val
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Ignite thread state Waiting/blocked

Posted by vkulichenko <va...@gmail.com>.
1. Can you show full thread dump, not only the thread that creates atomic
sequence? Also are there any exception on server nodes?
2. You can use IgniteSpringBean to initialize Ignite as a bean, and then
inherit other stuff from it.

-Val



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