Re: service deploy cluster singleton lock application

2018-07-26 Thread Evgenii Zhuravlev
Looks like TaskLockWatcher is an inner class, isn't it? When you deploy
service, an instance of it will be serialized and saved to cache. If this
class in inner, most possible it serializes an outer class too. Try to
create not nested Class for Service.

2018-07-26 18:14 GMT+03:00 sergey.dolinkov :

> upload as files
>
> locked-node-treaddump.txt
>  t1909/locked-node-treaddump.txt>
> worked-node-threaddump.txt
>  t1909/worked-node-threaddump.txt>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>


Re: service deploy cluster singleton lock application

2018-07-26 Thread sergey.dolinkov
upload as files

locked-node-treaddump.txt

  
worked-node-threaddump.txt

  



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


Re: service deploy cluster singleton lock application

2018-07-26 Thread sergey.dolinkov
After a little analysis of the source code, I found out that 
when I called the method deployClusterSingleton
I get GridServiceDeploymentCompoundFuture and it is never complite.



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


Re: service deploy cluster singleton lock application

2018-07-26 Thread Evgenii Zhuravlev
Well, then, do you have a mall reproducer for your issue? Or at least
thread dumps, that I've mentioned in my previous message?

Evgenii

2018-07-26 13:19 GMT+03:00 sergey.dolinkov :

> This is an example.
> The original code is more complicated.
> For configuration, we convert megabytes to bytes.
> In this example, there are no errors in the logs.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>


Re: service deploy cluster singleton lock application

2018-07-26 Thread sergey.dolinkov
This is an example.
The original code is more complicated.
For configuration, we convert megabytes to bytes.
In this example, there are no errors in the logs.



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


Re: service deploy cluster singleton lock application

2018-07-26 Thread ezhuravlev
Hi,

As per java doc of DataRegionConfiguration.setMaxSize - maxSize Maximum data
region size in bytes. For sure, it won't work properly with such a small
memory size(128 and 1024 bytes). Ignite even have validation for this
parameter and it should be not less than 10mb at least.

Have you checked your logs? Do you have any exceptions? Have you checked
thread dumps? Where was it hanged?

Regards,
Evgenii



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


service deploy cluster singleton lock application

2018-07-25 Thread sergey.dolinkov


I try create spring java application with apache ignite inside.

When application startup it deploy service(cluster singleton) to cluster.
(it`s ok)

But when i start second node which deploy this service too it is locked.

why this hapends ? Apache Ignite 2.5.0

code of service class:

public class TaskLockWatcher implements Service {
@IgniteInstanceResource
private Ignite ignite;
private SchedulerFuture scheduler;

@Override
public void cancel(ServiceContext ctx) {
  LOGGER.info("schedule service cancel");
  if (scheduler != null){
scheduler.cancel();
scheduler = null;
  }
}

@Override
public void init(ServiceContext ctx) throws Exception {
  LOGGER.info("schedule service init");
}

@Override
public void execute(ServiceContext ctx) throws Exception {
  LOGGER.info("schedule service execute");
  if (scheduler == null){
scheduler = ignite.scheduler().scheduleLocal(() -> {
  LOGGER.info("schedule service call");
  List tickets = getTicketForUnlock();
  if (!tickets.isEmpty()){
changeTicketStatus(tickets, TicketStatus.CREATED);
  }
}, "* * * * *");
  }
}
  }

But the locking occurs even if I leave only the output of messages in all
TaskLockWatcher methods.

publishing code:

Ignite ignite = connector.getClient();
IgniteServices svcs = ignite.services();
svcs.deployClusterSingleton("taskLockWatcher", new TaskLockWatcher());


ignite configuration code:

IgniteConfiguration igniteConfiguration = new IgniteConfiguration();
DataStorageConfiguration dataStorageConfiguration = new
DataStorageConfiguration();
dataStorageConfiguration.setWalMode(WALMode.LOG_ONLY);
dataStorageConfiguration.getDefaultDataRegionConfiguration().setPersistenceEnabled(false);
dataStorageConfiguration.getDefaultDataRegionConfiguration().setMaxSize(128);
// MB

List list = new ArrayList<>();
DataRegionConfiguration configuration = new DataRegionConfiguration();
configuration.setName("TASK_REGION");
configuration.setMaxSize(1024);
configuration.setPersistenceEnabled(true);
list.add(conf); 
dataStorageConfiguration.setDataRegionConfigurations(list.toArray(new
DataRegionConfiguration[0]));
   
igniteConfiguration.setDataStorageConfiguration(dataStorageConfiguration);

TcpCommunicationSpi tcpCommunicationSpi = new TcpCommunicationSpi();
tcpCommunicationSpi.setSlowClientQueueLimit(1000);
igniteConfiguration.setCommunicationSpi(tcpCommunicationSpi);
Map attrs =
Collections.singletonMap("group.node.filter",
"CLUSTER_TASKS,CLUSTER_TICKETS");
igniteConfiguration.setUserAttributes(attrs);

TcpDiscoverySpi spi = new TcpDiscoverySpi();
TcpDiscoveryZookeeperIpFinder ipFinder = new
TcpDiscoveryZookeeperIpFinder();
ipFinder.setBasePath("/datagrid");
ipFinder.setCurator(getCuratorFramework());
spi.setIpFinder(ipFinder);
igniteConfiguration.setDiscoverySpi(spi);

AtomicConfiguration atomicConfiguration = new AtomicConfiguration();
atomicConfiguration.setBackups(1);
atomicConfiguration.setCacheMode(CacheMode.REPLICATED);
igniteConfiguration.setAtomicConfiguration(atomicConfiguration);
igniteConfiguration.setIncludeEventTypes(EventType.EVTS_CACHE);

CacheConfiguration cacheConfiguration = new
CacheConfiguration<>("TICKETS");
cacheConfiguration.setIndexedTypes(keyClass, UUID.class);



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