[jira] [Commented] (IGNITE-12894) Cannot use IgniteAtomicSequence in Ignite services

2020-05-15 Thread Mikhail Petrov (Jira)


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

Mikhail Petrov commented on IGNITE-12894:
-

[~daradurvs], Thanks a lot for the review.

> Cannot use IgniteAtomicSequence in Ignite services
> --
>
> Key: IGNITE-12894
> URL: https://issues.apache.org/jira/browse/IGNITE-12894
> Project: Ignite
>  Issue Type: Bug
>  Components: compute
>Affects Versions: 2.8
>Reporter: Alexey Kukushkin
>Assignee: Mikhail Petrov
>Priority: Major
>  Labels: sbcf
> Fix For: 2.9
>
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> h2. Repro Steps
> Execute the below steps in default service deployment mode and in 
> discovery-based service deployment mode. 
>  Use {{-DIGNITE_EVENT_DRIVEN_SERVICE_PROCESSOR_ENABLED=true}} JVM option to 
> switch to the discovery-based service deployment mode.
>  * Create a service initializing an {{IgniteAtomicService}} in method 
> {{Service#init()}} and using the {{IgniteAtomicService}} in a business method.
>  * Start an Ignite node with the service specified in the IgniteConfiguration
>  * Invoke the service's business method on the Ignite node
> h3. Actual Result
> h4. In Default Service Deployment Mode
> Deadlock on the business method invocation
> h4. In Discovery-Based Service Deployment Mode
> The method invocation fails with {{IgniteException: Failed to find deployed 
> service: IgniteTestService}}
> h2. Reproducer
> h3. Test.java
> {code:java}
> public interface Test {
> String sayHello(String name);
> }
> {code}
> h3. IgniteTestService.java
> {code:java}
> public class IgniteTestService implements Test, Service {
> private @IgniteInstanceResource Ignite ignite;
> private IgniteAtomicSequence seq;
> @Override public void cancel(ServiceContext ctx) {
> }
> @Override public void init(ServiceContext ctx) throws 
> InterruptedException {
> seq = ignite.atomicSequence("TestSeq", 0, true);
> }
> @Override public void execute(ServiceContext ctx) {
> }
> @Override public String sayHello(String name) {
> return "Hello, " + name + "! #" + seq.getAndIncrement();
> }
> }
> {code}
> h3. Reproducer.java
> {code:java}
> public class Reproducer {
> public static void main(String[] args) {
> IgniteConfiguration igniteCfg = new IgniteConfiguration()
> .setServiceConfiguration(
> new ServiceConfiguration()
> .setName(IgniteTestService.class.getSimpleName())
> .setMaxPerNodeCount(1)
> .setTotalCount(0)
> .setService(new IgniteTestService())
> )
> .setDiscoverySpi(
> new TcpDiscoverySpi()
> .setIpFinder(new 
> TcpDiscoveryVmIpFinder().setAddresses(Collections.singleton("127.0.0.1:47500")))
> );
> try (Ignite ignite = Ignition.start(igniteCfg)) {
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false)
> .sayHello("World");
> }
> }
> }
> {code}
> h2. Workaround
> Specifying a service wait timeout solves the problem in the discovery-based 
> service deployment mode (but not in the default deployment mode):
> {code:java}
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false, 1_000)
> .sayHello("World");
> {code}
> This workaround cannot be used in Ignite.NET clients since .NET 
> {{GetServiceProxy}} API does not support the service wait timeout, which is 
> hard-coded to 0 on the server side.
> h2. Full Exception in Discovery-Based Service Deployment Mode
> {noformat}
> [01:08:54,653][SEVERE][services-deployment-worker-#52][IgniteServiceProcessor]
>  Failed to initialize service (service will not be deployed): 
> IgniteTestService
> class org.apache.ignite.IgniteInterruptedException: Got interrupted while 
> waiting for future to complete.
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:888)
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:886)
>   at 
> org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:1062)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3999)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3985)
>   at Sandbox.Net.IgniteTestService.init(IgniteTestService.java:17)
>   at 
> org.apache.ignite.internal.processors.service.IgniteServiceProcessor.redeploy(IgniteServiceProcessor.java:1188)
>   at 
> 

[jira] [Commented] (IGNITE-12894) Cannot use IgniteAtomicSequence in Ignite services

2020-05-15 Thread Vyacheslav Daradur (Jira)


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

Vyacheslav Daradur commented on IGNITE-12894:
-

[~PetrovMikhail], merged to master.

Thanks for your contribution!

> Cannot use IgniteAtomicSequence in Ignite services
> --
>
> Key: IGNITE-12894
> URL: https://issues.apache.org/jira/browse/IGNITE-12894
> Project: Ignite
>  Issue Type: Bug
>  Components: compute
>Affects Versions: 2.8
>Reporter: Alexey Kukushkin
>Assignee: Mikhail Petrov
>Priority: Major
>  Labels: sbcf
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> h2. Repro Steps
> Execute the below steps in default service deployment mode and in 
> discovery-based service deployment mode. 
>  Use {{-DIGNITE_EVENT_DRIVEN_SERVICE_PROCESSOR_ENABLED=true}} JVM option to 
> switch to the discovery-based service deployment mode.
>  * Create a service initializing an {{IgniteAtomicService}} in method 
> {{Service#init()}} and using the {{IgniteAtomicService}} in a business method.
>  * Start an Ignite node with the service specified in the IgniteConfiguration
>  * Invoke the service's business method on the Ignite node
> h3. Actual Result
> h4. In Default Service Deployment Mode
> Deadlock on the business method invocation
> h4. In Discovery-Based Service Deployment Mode
> The method invocation fails with {{IgniteException: Failed to find deployed 
> service: IgniteTestService}}
> h2. Reproducer
> h3. Test.java
> {code:java}
> public interface Test {
> String sayHello(String name);
> }
> {code}
> h3. IgniteTestService.java
> {code:java}
> public class IgniteTestService implements Test, Service {
> private @IgniteInstanceResource Ignite ignite;
> private IgniteAtomicSequence seq;
> @Override public void cancel(ServiceContext ctx) {
> }
> @Override public void init(ServiceContext ctx) throws 
> InterruptedException {
> seq = ignite.atomicSequence("TestSeq", 0, true);
> }
> @Override public void execute(ServiceContext ctx) {
> }
> @Override public String sayHello(String name) {
> return "Hello, " + name + "! #" + seq.getAndIncrement();
> }
> }
> {code}
> h3. Reproducer.java
> {code:java}
> public class Reproducer {
> public static void main(String[] args) {
> IgniteConfiguration igniteCfg = new IgniteConfiguration()
> .setServiceConfiguration(
> new ServiceConfiguration()
> .setName(IgniteTestService.class.getSimpleName())
> .setMaxPerNodeCount(1)
> .setTotalCount(0)
> .setService(new IgniteTestService())
> )
> .setDiscoverySpi(
> new TcpDiscoverySpi()
> .setIpFinder(new 
> TcpDiscoveryVmIpFinder().setAddresses(Collections.singleton("127.0.0.1:47500")))
> );
> try (Ignite ignite = Ignition.start(igniteCfg)) {
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false)
> .sayHello("World");
> }
> }
> }
> {code}
> h2. Workaround
> Specifying a service wait timeout solves the problem in the discovery-based 
> service deployment mode (but not in the default deployment mode):
> {code:java}
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false, 1_000)
> .sayHello("World");
> {code}
> This workaround cannot be used in Ignite.NET clients since .NET 
> {{GetServiceProxy}} API does not support the service wait timeout, which is 
> hard-coded to 0 on the server side.
> h2. Full Exception in Discovery-Based Service Deployment Mode
> {noformat}
> [01:08:54,653][SEVERE][services-deployment-worker-#52][IgniteServiceProcessor]
>  Failed to initialize service (service will not be deployed): 
> IgniteTestService
> class org.apache.ignite.IgniteInterruptedException: Got interrupted while 
> waiting for future to complete.
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:888)
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:886)
>   at 
> org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:1062)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3999)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3985)
>   at Sandbox.Net.IgniteTestService.init(IgniteTestService.java:17)
>   at 
> org.apache.ignite.internal.processors.service.IgniteServiceProcessor.redeploy(IgniteServiceProcessor.java:1188)
>   at 
> 

[jira] [Commented] (IGNITE-12894) Cannot use IgniteAtomicSequence in Ignite services

2020-05-15 Thread Mikhail Petrov (Jira)


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

Mikhail Petrov commented on IGNITE-12894:
-

[~daradurvs], I've rerun TC and got the fresh visa. Could you please take a 
look?

> Cannot use IgniteAtomicSequence in Ignite services
> --
>
> Key: IGNITE-12894
> URL: https://issues.apache.org/jira/browse/IGNITE-12894
> Project: Ignite
>  Issue Type: Bug
>  Components: compute
>Affects Versions: 2.8
>Reporter: Alexey Kukushkin
>Assignee: Mikhail Petrov
>Priority: Major
>  Labels: sbcf
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> h2. Repro Steps
> Execute the below steps in default service deployment mode and in 
> discovery-based service deployment mode. 
>  Use {{-DIGNITE_EVENT_DRIVEN_SERVICE_PROCESSOR_ENABLED=true}} JVM option to 
> switch to the discovery-based service deployment mode.
>  * Create a service initializing an {{IgniteAtomicService}} in method 
> {{Service#init()}} and using the {{IgniteAtomicService}} in a business method.
>  * Start an Ignite node with the service specified in the IgniteConfiguration
>  * Invoke the service's business method on the Ignite node
> h3. Actual Result
> h4. In Default Service Deployment Mode
> Deadlock on the business method invocation
> h4. In Discovery-Based Service Deployment Mode
> The method invocation fails with {{IgniteException: Failed to find deployed 
> service: IgniteTestService}}
> h2. Reproducer
> h3. Test.java
> {code:java}
> public interface Test {
> String sayHello(String name);
> }
> {code}
> h3. IgniteTestService.java
> {code:java}
> public class IgniteTestService implements Test, Service {
> private @IgniteInstanceResource Ignite ignite;
> private IgniteAtomicSequence seq;
> @Override public void cancel(ServiceContext ctx) {
> }
> @Override public void init(ServiceContext ctx) throws 
> InterruptedException {
> seq = ignite.atomicSequence("TestSeq", 0, true);
> }
> @Override public void execute(ServiceContext ctx) {
> }
> @Override public String sayHello(String name) {
> return "Hello, " + name + "! #" + seq.getAndIncrement();
> }
> }
> {code}
> h3. Reproducer.java
> {code:java}
> public class Reproducer {
> public static void main(String[] args) {
> IgniteConfiguration igniteCfg = new IgniteConfiguration()
> .setServiceConfiguration(
> new ServiceConfiguration()
> .setName(IgniteTestService.class.getSimpleName())
> .setMaxPerNodeCount(1)
> .setTotalCount(0)
> .setService(new IgniteTestService())
> )
> .setDiscoverySpi(
> new TcpDiscoverySpi()
> .setIpFinder(new 
> TcpDiscoveryVmIpFinder().setAddresses(Collections.singleton("127.0.0.1:47500")))
> );
> try (Ignite ignite = Ignition.start(igniteCfg)) {
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false)
> .sayHello("World");
> }
> }
> }
> {code}
> h2. Workaround
> Specifying a service wait timeout solves the problem in the discovery-based 
> service deployment mode (but not in the default deployment mode):
> {code:java}
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false, 1_000)
> .sayHello("World");
> {code}
> This workaround cannot be used in Ignite.NET clients since .NET 
> {{GetServiceProxy}} API does not support the service wait timeout, which is 
> hard-coded to 0 on the server side.
> h2. Full Exception in Discovery-Based Service Deployment Mode
> {noformat}
> [01:08:54,653][SEVERE][services-deployment-worker-#52][IgniteServiceProcessor]
>  Failed to initialize service (service will not be deployed): 
> IgniteTestService
> class org.apache.ignite.IgniteInterruptedException: Got interrupted while 
> waiting for future to complete.
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:888)
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:886)
>   at 
> org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:1062)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3999)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3985)
>   at Sandbox.Net.IgniteTestService.init(IgniteTestService.java:17)
>   at 
> org.apache.ignite.internal.processors.service.IgniteServiceProcessor.redeploy(IgniteServiceProcessor.java:1188)
>   at 
> 

[jira] [Commented] (IGNITE-12894) Cannot use IgniteAtomicSequence in Ignite services

2020-05-15 Thread Ignite TC Bot (Jira)


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

Ignite TC Bot commented on IGNITE-12894:


{panel:title=Branch: [pull/7771/head] Base: [master] : No blockers 
found!|borderStyle=dashed|borderColor=#ccc|titleBGColor=#D6F7C1}{panel}
[TeamCity *-- Run :: All* 
Results|https://ci.ignite.apache.org/viewLog.html?buildId=5308533buildTypeId=IgniteTests24Java8_RunAll]

> Cannot use IgniteAtomicSequence in Ignite services
> --
>
> Key: IGNITE-12894
> URL: https://issues.apache.org/jira/browse/IGNITE-12894
> Project: Ignite
>  Issue Type: Bug
>  Components: compute
>Affects Versions: 2.8
>Reporter: Alexey Kukushkin
>Assignee: Mikhail Petrov
>Priority: Major
>  Labels: sbcf
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> h2. Repro Steps
> Execute the below steps in default service deployment mode and in 
> discovery-based service deployment mode. 
>  Use {{-DIGNITE_EVENT_DRIVEN_SERVICE_PROCESSOR_ENABLED=true}} JVM option to 
> switch to the discovery-based service deployment mode.
>  * Create a service initializing an {{IgniteAtomicService}} in method 
> {{Service#init()}} and using the {{IgniteAtomicService}} in a business method.
>  * Start an Ignite node with the service specified in the IgniteConfiguration
>  * Invoke the service's business method on the Ignite node
> h3. Actual Result
> h4. In Default Service Deployment Mode
> Deadlock on the business method invocation
> h4. In Discovery-Based Service Deployment Mode
> The method invocation fails with {{IgniteException: Failed to find deployed 
> service: IgniteTestService}}
> h2. Reproducer
> h3. Test.java
> {code:java}
> public interface Test {
> String sayHello(String name);
> }
> {code}
> h3. IgniteTestService.java
> {code:java}
> public class IgniteTestService implements Test, Service {
> private @IgniteInstanceResource Ignite ignite;
> private IgniteAtomicSequence seq;
> @Override public void cancel(ServiceContext ctx) {
> }
> @Override public void init(ServiceContext ctx) throws 
> InterruptedException {
> seq = ignite.atomicSequence("TestSeq", 0, true);
> }
> @Override public void execute(ServiceContext ctx) {
> }
> @Override public String sayHello(String name) {
> return "Hello, " + name + "! #" + seq.getAndIncrement();
> }
> }
> {code}
> h3. Reproducer.java
> {code:java}
> public class Reproducer {
> public static void main(String[] args) {
> IgniteConfiguration igniteCfg = new IgniteConfiguration()
> .setServiceConfiguration(
> new ServiceConfiguration()
> .setName(IgniteTestService.class.getSimpleName())
> .setMaxPerNodeCount(1)
> .setTotalCount(0)
> .setService(new IgniteTestService())
> )
> .setDiscoverySpi(
> new TcpDiscoverySpi()
> .setIpFinder(new 
> TcpDiscoveryVmIpFinder().setAddresses(Collections.singleton("127.0.0.1:47500")))
> );
> try (Ignite ignite = Ignition.start(igniteCfg)) {
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false)
> .sayHello("World");
> }
> }
> }
> {code}
> h2. Workaround
> Specifying a service wait timeout solves the problem in the discovery-based 
> service deployment mode (but not in the default deployment mode):
> {code:java}
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false, 1_000)
> .sayHello("World");
> {code}
> This workaround cannot be used in Ignite.NET clients since .NET 
> {{GetServiceProxy}} API does not support the service wait timeout, which is 
> hard-coded to 0 on the server side.
> h2. Full Exception in Discovery-Based Service Deployment Mode
> {noformat}
> [01:08:54,653][SEVERE][services-deployment-worker-#52][IgniteServiceProcessor]
>  Failed to initialize service (service will not be deployed): 
> IgniteTestService
> class org.apache.ignite.IgniteInterruptedException: Got interrupted while 
> waiting for future to complete.
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:888)
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:886)
>   at 
> org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:1062)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3999)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3985)
>   at Sandbox.Net.IgniteTestService.init(IgniteTestService.java:17)
>   at 
> 

[jira] [Commented] (IGNITE-12894) Cannot use IgniteAtomicSequence in Ignite services

2020-05-13 Thread Mikhail Petrov (Jira)


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

Mikhail Petrov commented on IGNITE-12894:
-

[~daradurvs], I fixed mentioned by you comments. Could you please take a look.

> Cannot use IgniteAtomicSequence in Ignite services
> --
>
> Key: IGNITE-12894
> URL: https://issues.apache.org/jira/browse/IGNITE-12894
> Project: Ignite
>  Issue Type: Bug
>  Components: compute
>Affects Versions: 2.8
>Reporter: Alexey Kukushkin
>Assignee: Mikhail Petrov
>Priority: Major
>  Labels: sbcf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> h2. Repro Steps
> Execute the below steps in default service deployment mode and in 
> discovery-based service deployment mode. 
>  Use {{-DIGNITE_EVENT_DRIVEN_SERVICE_PROCESSOR_ENABLED=true}} JVM option to 
> switch to the discovery-based service deployment mode.
>  * Create a service initializing an {{IgniteAtomicService}} in method 
> {{Service#init()}} and using the {{IgniteAtomicService}} in a business method.
>  * Start an Ignite node with the service specified in the IgniteConfiguration
>  * Invoke the service's business method on the Ignite node
> h3. Actual Result
> h4. In Default Service Deployment Mode
> Deadlock on the business method invocation
> h4. In Discovery-Based Service Deployment Mode
> The method invocation fails with {{IgniteException: Failed to find deployed 
> service: IgniteTestService}}
> h2. Reproducer
> h3. Test.java
> {code:java}
> public interface Test {
> String sayHello(String name);
> }
> {code}
> h3. IgniteTestService.java
> {code:java}
> public class IgniteTestService implements Test, Service {
> private @IgniteInstanceResource Ignite ignite;
> private IgniteAtomicSequence seq;
> @Override public void cancel(ServiceContext ctx) {
> }
> @Override public void init(ServiceContext ctx) throws 
> InterruptedException {
> seq = ignite.atomicSequence("TestSeq", 0, true);
> }
> @Override public void execute(ServiceContext ctx) {
> }
> @Override public String sayHello(String name) {
> return "Hello, " + name + "! #" + seq.getAndIncrement();
> }
> }
> {code}
> h3. Reproducer.java
> {code:java}
> public class Reproducer {
> public static void main(String[] args) {
> IgniteConfiguration igniteCfg = new IgniteConfiguration()
> .setServiceConfiguration(
> new ServiceConfiguration()
> .setName(IgniteTestService.class.getSimpleName())
> .setMaxPerNodeCount(1)
> .setTotalCount(0)
> .setService(new IgniteTestService())
> )
> .setDiscoverySpi(
> new TcpDiscoverySpi()
> .setIpFinder(new 
> TcpDiscoveryVmIpFinder().setAddresses(Collections.singleton("127.0.0.1:47500")))
> );
> try (Ignite ignite = Ignition.start(igniteCfg)) {
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false)
> .sayHello("World");
> }
> }
> }
> {code}
> h2. Workaround
> Specifying a service wait timeout solves the problem in the discovery-based 
> service deployment mode (but not in the default deployment mode):
> {code:java}
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false, 1_000)
> .sayHello("World");
> {code}
> This workaround cannot be used in Ignite.NET clients since .NET 
> {{GetServiceProxy}} API does not support the service wait timeout, which is 
> hard-coded to 0 on the server side.
> h2. Full Exception in Discovery-Based Service Deployment Mode
> {noformat}
> [01:08:54,653][SEVERE][services-deployment-worker-#52][IgniteServiceProcessor]
>  Failed to initialize service (service will not be deployed): 
> IgniteTestService
> class org.apache.ignite.IgniteInterruptedException: Got interrupted while 
> waiting for future to complete.
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:888)
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:886)
>   at 
> org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:1062)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3999)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3985)
>   at Sandbox.Net.IgniteTestService.init(IgniteTestService.java:17)
>   at 
> org.apache.ignite.internal.processors.service.IgniteServiceProcessor.redeploy(IgniteServiceProcessor.java:1188)
>   at 
> 

[jira] [Commented] (IGNITE-12894) Cannot use IgniteAtomicSequence in Ignite services

2020-05-13 Thread Ignite TC Bot (Jira)


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

Ignite TC Bot commented on IGNITE-12894:


{panel:title=Branch: [pull/7771/head] Base: [master] : No blockers 
found!|borderStyle=dashed|borderColor=#ccc|titleBGColor=#D6F7C1}{panel}
[TeamCity *-- Run :: All* 
Results|https://ci.ignite.apache.org/viewLog.html?buildId=5303548buildTypeId=IgniteTests24Java8_RunAll]

> Cannot use IgniteAtomicSequence in Ignite services
> --
>
> Key: IGNITE-12894
> URL: https://issues.apache.org/jira/browse/IGNITE-12894
> Project: Ignite
>  Issue Type: Bug
>  Components: compute
>Affects Versions: 2.8
>Reporter: Alexey Kukushkin
>Assignee: Mikhail Petrov
>Priority: Major
>  Labels: sbcf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> h2. Repro Steps
> Execute the below steps in default service deployment mode and in 
> discovery-based service deployment mode. 
>  Use {{-DIGNITE_EVENT_DRIVEN_SERVICE_PROCESSOR_ENABLED=true}} JVM option to 
> switch to the discovery-based service deployment mode.
>  * Create a service initializing an {{IgniteAtomicService}} in method 
> {{Service#init()}} and using the {{IgniteAtomicService}} in a business method.
>  * Start an Ignite node with the service specified in the IgniteConfiguration
>  * Invoke the service's business method on the Ignite node
> h3. Actual Result
> h4. In Default Service Deployment Mode
> Deadlock on the business method invocation
> h4. In Discovery-Based Service Deployment Mode
> The method invocation fails with {{IgniteException: Failed to find deployed 
> service: IgniteTestService}}
> h2. Reproducer
> h3. Test.java
> {code:java}
> public interface Test {
> String sayHello(String name);
> }
> {code}
> h3. IgniteTestService.java
> {code:java}
> public class IgniteTestService implements Test, Service {
> private @IgniteInstanceResource Ignite ignite;
> private IgniteAtomicSequence seq;
> @Override public void cancel(ServiceContext ctx) {
> }
> @Override public void init(ServiceContext ctx) throws 
> InterruptedException {
> seq = ignite.atomicSequence("TestSeq", 0, true);
> }
> @Override public void execute(ServiceContext ctx) {
> }
> @Override public String sayHello(String name) {
> return "Hello, " + name + "! #" + seq.getAndIncrement();
> }
> }
> {code}
> h3. Reproducer.java
> {code:java}
> public class Reproducer {
> public static void main(String[] args) {
> IgniteConfiguration igniteCfg = new IgniteConfiguration()
> .setServiceConfiguration(
> new ServiceConfiguration()
> .setName(IgniteTestService.class.getSimpleName())
> .setMaxPerNodeCount(1)
> .setTotalCount(0)
> .setService(new IgniteTestService())
> )
> .setDiscoverySpi(
> new TcpDiscoverySpi()
> .setIpFinder(new 
> TcpDiscoveryVmIpFinder().setAddresses(Collections.singleton("127.0.0.1:47500")))
> );
> try (Ignite ignite = Ignition.start(igniteCfg)) {
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false)
> .sayHello("World");
> }
> }
> }
> {code}
> h2. Workaround
> Specifying a service wait timeout solves the problem in the discovery-based 
> service deployment mode (but not in the default deployment mode):
> {code:java}
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false, 1_000)
> .sayHello("World");
> {code}
> This workaround cannot be used in Ignite.NET clients since .NET 
> {{GetServiceProxy}} API does not support the service wait timeout, which is 
> hard-coded to 0 on the server side.
> h2. Full Exception in Discovery-Based Service Deployment Mode
> {noformat}
> [01:08:54,653][SEVERE][services-deployment-worker-#52][IgniteServiceProcessor]
>  Failed to initialize service (service will not be deployed): 
> IgniteTestService
> class org.apache.ignite.IgniteInterruptedException: Got interrupted while 
> waiting for future to complete.
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:888)
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:886)
>   at 
> org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:1062)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3999)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3985)
>   at Sandbox.Net.IgniteTestService.init(IgniteTestService.java:17)
>   at 
> 

[jira] [Commented] (IGNITE-12894) Cannot use IgniteAtomicSequence in Ignite services

2020-05-13 Thread Vyacheslav Daradur (Jira)


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

Vyacheslav Daradur commented on IGNITE-12894:
-

Hi, [~PetrovMikhail]. I can't find a link to TC-tests and TC-bot visa despite 
the fact that the task is in patch-available state.
Please get TC-bot visa and link TC-tests.


> Cannot use IgniteAtomicSequence in Ignite services
> --
>
> Key: IGNITE-12894
> URL: https://issues.apache.org/jira/browse/IGNITE-12894
> Project: Ignite
>  Issue Type: Bug
>  Components: compute
>Affects Versions: 2.8
>Reporter: Alexey Kukushkin
>Assignee: Mikhail Petrov
>Priority: Major
>  Labels: sbcf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> h2. Repro Steps
> Execute the below steps in default service deployment mode and in 
> discovery-based service deployment mode. 
>  Use {{-DIGNITE_EVENT_DRIVEN_SERVICE_PROCESSOR_ENABLED=true}} JVM option to 
> switch to the discovery-based service deployment mode.
>  * Create a service initializing an {{IgniteAtomicService}} in method 
> {{Service#init()}} and using the {{IgniteAtomicService}} in a business method.
>  * Start an Ignite node with the service specified in the IgniteConfiguration
>  * Invoke the service's business method on the Ignite node
> h3. Actual Result
> h4. In Default Service Deployment Mode
> Deadlock on the business method invocation
> h4. In Discovery-Based Service Deployment Mode
> The method invocation fails with {{IgniteException: Failed to find deployed 
> service: IgniteTestService}}
> h2. Reproducer
> h3. Test.java
> {code:java}
> public interface Test {
> String sayHello(String name);
> }
> {code}
> h3. IgniteTestService.java
> {code:java}
> public class IgniteTestService implements Test, Service {
> private @IgniteInstanceResource Ignite ignite;
> private IgniteAtomicSequence seq;
> @Override public void cancel(ServiceContext ctx) {
> }
> @Override public void init(ServiceContext ctx) throws 
> InterruptedException {
> seq = ignite.atomicSequence("TestSeq", 0, true);
> }
> @Override public void execute(ServiceContext ctx) {
> }
> @Override public String sayHello(String name) {
> return "Hello, " + name + "! #" + seq.getAndIncrement();
> }
> }
> {code}
> h3. Reproducer.java
> {code:java}
> public class Reproducer {
> public static void main(String[] args) {
> IgniteConfiguration igniteCfg = new IgniteConfiguration()
> .setServiceConfiguration(
> new ServiceConfiguration()
> .setName(IgniteTestService.class.getSimpleName())
> .setMaxPerNodeCount(1)
> .setTotalCount(0)
> .setService(new IgniteTestService())
> )
> .setDiscoverySpi(
> new TcpDiscoverySpi()
> .setIpFinder(new 
> TcpDiscoveryVmIpFinder().setAddresses(Collections.singleton("127.0.0.1:47500")))
> );
> try (Ignite ignite = Ignition.start(igniteCfg)) {
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false)
> .sayHello("World");
> }
> }
> }
> {code}
> h2. Workaround
> Specifying a service wait timeout solves the problem in the discovery-based 
> service deployment mode (but not in the default deployment mode):
> {code:java}
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false, 1_000)
> .sayHello("World");
> {code}
> This workaround cannot be used in Ignite.NET clients since .NET 
> {{GetServiceProxy}} API does not support the service wait timeout, which is 
> hard-coded to 0 on the server side.
> h2. Full Exception in Discovery-Based Service Deployment Mode
> {noformat}
> [01:08:54,653][SEVERE][services-deployment-worker-#52][IgniteServiceProcessor]
>  Failed to initialize service (service will not be deployed): 
> IgniteTestService
> class org.apache.ignite.IgniteInterruptedException: Got interrupted while 
> waiting for future to complete.
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:888)
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:886)
>   at 
> org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:1062)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3999)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3985)
>   at Sandbox.Net.IgniteTestService.init(IgniteTestService.java:17)
>   at 
> 

[jira] [Commented] (IGNITE-12894) Cannot use IgniteAtomicSequence in Ignite services

2020-05-06 Thread Mikhail Petrov (Jira)


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

Mikhail Petrov commented on IGNITE-12894:
-

[~dmekhanikov], could you please take a look?

> Cannot use IgniteAtomicSequence in Ignite services
> --
>
> Key: IGNITE-12894
> URL: https://issues.apache.org/jira/browse/IGNITE-12894
> Project: Ignite
>  Issue Type: Bug
>  Components: compute
>Affects Versions: 2.8
>Reporter: Alexey Kukushkin
>Assignee: Mikhail Petrov
>Priority: Major
>  Labels: sbcf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> h2. Repro Steps
> Execute the below steps in default service deployment mode and in 
> discovery-based service deployment mode. 
>  Use {{-DIGNITE_EVENT_DRIVEN_SERVICE_PROCESSOR_ENABLED=true}} JVM option to 
> switch to the discovery-based service deployment mode.
>  * Create a service initializing an {{IgniteAtomicService}} in method 
> {{Service#init()}} and using the {{IgniteAtomicService}} in a business method.
>  * Start an Ignite node with the service specified in the IgniteConfiguration
>  * Invoke the service's business method on the Ignite node
> h3. Actual Result
> h4. In Default Service Deployment Mode
> Deadlock on the business method invocation
> h4. In Discovery-Based Service Deployment Mode
> The method invocation fails with {{IgniteException: Failed to find deployed 
> service: IgniteTestService}}
> h2. Reproducer
> h3. Test.java
> {code:java}
> public interface Test {
> String sayHello(String name);
> }
> {code}
> h3. IgniteTestService.java
> {code:java}
> public class IgniteTestService implements Test, Service {
> private @IgniteInstanceResource Ignite ignite;
> private IgniteAtomicSequence seq;
> @Override public void cancel(ServiceContext ctx) {
> }
> @Override public void init(ServiceContext ctx) throws 
> InterruptedException {
> seq = ignite.atomicSequence("TestSeq", 0, true);
> }
> @Override public void execute(ServiceContext ctx) {
> }
> @Override public String sayHello(String name) {
> return "Hello, " + name + "! #" + seq.getAndIncrement();
> }
> }
> {code}
> h3. Reproducer.java
> {code:java}
> public class Reproducer {
> public static void main(String[] args) {
> IgniteConfiguration igniteCfg = new IgniteConfiguration()
> .setServiceConfiguration(
> new ServiceConfiguration()
> .setName(IgniteTestService.class.getSimpleName())
> .setMaxPerNodeCount(1)
> .setTotalCount(0)
> .setService(new IgniteTestService())
> )
> .setDiscoverySpi(
> new TcpDiscoverySpi()
> .setIpFinder(new 
> TcpDiscoveryVmIpFinder().setAddresses(Collections.singleton("127.0.0.1:47500")))
> );
> try (Ignite ignite = Ignition.start(igniteCfg)) {
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false)
> .sayHello("World");
> }
> }
> }
> {code}
> h2. Workaround
> Specifying a service wait timeout solves the problem in the discovery-based 
> service deployment mode (but not in the default deployment mode):
> {code:java}
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false, 1_000)
> .sayHello("World");
> {code}
> This workaround cannot be used in Ignite.NET clients since .NET 
> {{GetServiceProxy}} API does not support the service wait timeout, which is 
> hard-coded to 0 on the server side.
> h2. Full Exception in Discovery-Based Service Deployment Mode
> {noformat}
> [01:08:54,653][SEVERE][services-deployment-worker-#52][IgniteServiceProcessor]
>  Failed to initialize service (service will not be deployed): 
> IgniteTestService
> class org.apache.ignite.IgniteInterruptedException: Got interrupted while 
> waiting for future to complete.
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:888)
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:886)
>   at 
> org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:1062)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3999)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3985)
>   at Sandbox.Net.IgniteTestService.init(IgniteTestService.java:17)
>   at 
> org.apache.ignite.internal.processors.service.IgniteServiceProcessor.redeploy(IgniteServiceProcessor.java:1188)
>   at 
> 

[jira] [Commented] (IGNITE-12894) Cannot use IgniteAtomicSequence in Ignite services

2020-05-05 Thread Mikhail Petrov (Jira)


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

Mikhail Petrov commented on IGNITE-12894:
-

[~daradurvs],

Frankly, I didn't understand what it means to "resend request". Do you mean 
that [closure 
invocation|https://github.com/apache/ignite/blob/8cba313c9961b16e358834216e9992310f285985/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java#L186]?

If so, it will be called in the busy-wait loop only if returned by 
IgniteServiceProcessor#serviceTopology topology snapshot is stale(requested 
service is not deployed on a node which was obtained from the topology). So, in 
this case, we will "resend request" until full message will be received and 
topology updated.

At the moment I am only concerned about the case when serviceProxy method was 
invoked when the requested service topology was not initialized on local node 
yet(first full message with topology for requested service was not received but 
service was already registered)

I propose to block IgniteServiceProcessor#serviceTopology method call in this 
case and wait for the full message receiving. And only after that return 
topology snapshot to the GridServiceProxy which will determine the node-holder 
for the requested service. So for this case, we will wait "for a change of 
service topology on Ignite node without resending of request".
 Am I missing something?

Here is draft PR – [1]. Could you please take a look?

[1] - [https://github.com/apache/ignite/pull/7771]

> Cannot use IgniteAtomicSequence in Ignite services
> --
>
> Key: IGNITE-12894
> URL: https://issues.apache.org/jira/browse/IGNITE-12894
> Project: Ignite
>  Issue Type: Bug
>  Components: compute
>Affects Versions: 2.8
>Reporter: Alexey Kukushkin
>Assignee: Mikhail Petrov
>Priority: Major
>  Labels: sbcf
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> h2. Repro Steps
> Execute the below steps in default service deployment mode and in 
> discovery-based service deployment mode. 
>  Use {{-DIGNITE_EVENT_DRIVEN_SERVICE_PROCESSOR_ENABLED=true}} JVM option to 
> switch to the discovery-based service deployment mode.
>  * Create a service initializing an {{IgniteAtomicService}} in method 
> {{Service#init()}} and using the {{IgniteAtomicService}} in a business method.
>  * Start an Ignite node with the service specified in the IgniteConfiguration
>  * Invoke the service's business method on the Ignite node
> h3. Actual Result
> h4. In Default Service Deployment Mode
> Deadlock on the business method invocation
> h4. In Discovery-Based Service Deployment Mode
> The method invocation fails with {{IgniteException: Failed to find deployed 
> service: IgniteTestService}}
> h2. Reproducer
> h3. Test.java
> {code:java}
> public interface Test {
> String sayHello(String name);
> }
> {code}
> h3. IgniteTestService.java
> {code:java}
> public class IgniteTestService implements Test, Service {
> private @IgniteInstanceResource Ignite ignite;
> private IgniteAtomicSequence seq;
> @Override public void cancel(ServiceContext ctx) {
> }
> @Override public void init(ServiceContext ctx) throws 
> InterruptedException {
> seq = ignite.atomicSequence("TestSeq", 0, true);
> }
> @Override public void execute(ServiceContext ctx) {
> }
> @Override public String sayHello(String name) {
> return "Hello, " + name + "! #" + seq.getAndIncrement();
> }
> }
> {code}
> h3. Reproducer.java
> {code:java}
> public class Reproducer {
> public static void main(String[] args) {
> IgniteConfiguration igniteCfg = new IgniteConfiguration()
> .setServiceConfiguration(
> new ServiceConfiguration()
> .setName(IgniteTestService.class.getSimpleName())
> .setMaxPerNodeCount(1)
> .setTotalCount(0)
> .setService(new IgniteTestService())
> )
> .setDiscoverySpi(
> new TcpDiscoverySpi()
> .setIpFinder(new 
> TcpDiscoveryVmIpFinder().setAddresses(Collections.singleton("127.0.0.1:47500")))
> );
> try (Ignite ignite = Ignition.start(igniteCfg)) {
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false)
> .sayHello("World");
> }
> }
> }
> {code}
> h2. Workaround
> Specifying a service wait timeout solves the problem in the discovery-based 
> service deployment mode (but not in the default deployment mode):
> {code:java}
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false, 1_000)
> 

[jira] [Commented] (IGNITE-12894) Cannot use IgniteAtomicSequence in Ignite services

2020-05-04 Thread Vyacheslav Daradur (Jira)


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

Vyacheslav Daradur commented on IGNITE-12894:
-

[~PetrovMikhail], the suggestion proposed by you makes sense, but it covers the 
only case - the race between request sender state and remote node to invoke and 
allows the sender to resend request.

There are several disadvantages:
- multiple requests in comparison with possible handling of the case on a 
remote node (without resend requests)
- the infinite loop is possible in case of deployment failed, we should 
consider a case when deployment is failed and there is no sense resend request

I think we need a mechanism of waiting for a change of service topology on 
Ignite node without resending of request. The approach covers case with 
statically configured service from the task's description when service is 
called before deployment finished on a single node cluster. Also, the issue 
with remote proxy may be solved the same way.

> Cannot use IgniteAtomicSequence in Ignite services
> --
>
> Key: IGNITE-12894
> URL: https://issues.apache.org/jira/browse/IGNITE-12894
> Project: Ignite
>  Issue Type: Bug
>  Components: compute
>Affects Versions: 2.8
>Reporter: Alexey Kukushkin
>Assignee: Mikhail Petrov
>Priority: Major
>  Labels: sbcf
>
> h2. Repro Steps
> Execute the below steps in default service deployment mode and in 
> discovery-based service deployment mode. 
>  Use {{-DIGNITE_EVENT_DRIVEN_SERVICE_PROCESSOR_ENABLED=true}} JVM option to 
> switch to the discovery-based service deployment mode.
>  * Create a service initializing an {{IgniteAtomicService}} in method 
> {{Service#init()}} and using the {{IgniteAtomicService}} in a business method.
>  * Start an Ignite node with the service specified in the IgniteConfiguration
>  * Invoke the service's business method on the Ignite node
> h3. Actual Result
> h4. In Default Service Deployment Mode
> Deadlock on the business method invocation
> h4. In Discovery-Based Service Deployment Mode
> The method invocation fails with {{IgniteException: Failed to find deployed 
> service: IgniteTestService}}
> h2. Reproducer
> h3. Test.java
> {code:java}
> public interface Test {
> String sayHello(String name);
> }
> {code}
> h3. IgniteTestService.java
> {code:java}
> public class IgniteTestService implements Test, Service {
> private @IgniteInstanceResource Ignite ignite;
> private IgniteAtomicSequence seq;
> @Override public void cancel(ServiceContext ctx) {
> }
> @Override public void init(ServiceContext ctx) throws 
> InterruptedException {
> seq = ignite.atomicSequence("TestSeq", 0, true);
> }
> @Override public void execute(ServiceContext ctx) {
> }
> @Override public String sayHello(String name) {
> return "Hello, " + name + "! #" + seq.getAndIncrement();
> }
> }
> {code}
> h3. Reproducer.java
> {code:java}
> public class Reproducer {
> public static void main(String[] args) {
> IgniteConfiguration igniteCfg = new IgniteConfiguration()
> .setServiceConfiguration(
> new ServiceConfiguration()
> .setName(IgniteTestService.class.getSimpleName())
> .setMaxPerNodeCount(1)
> .setTotalCount(0)
> .setService(new IgniteTestService())
> )
> .setDiscoverySpi(
> new TcpDiscoverySpi()
> .setIpFinder(new 
> TcpDiscoveryVmIpFinder().setAddresses(Collections.singleton("127.0.0.1:47500")))
> );
> try (Ignite ignite = Ignition.start(igniteCfg)) {
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false)
> .sayHello("World");
> }
> }
> }
> {code}
> h2. Workaround
> Specifying a service wait timeout solves the problem in the discovery-based 
> service deployment mode (but not in the default deployment mode):
> {code:java}
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false, 1_000)
> .sayHello("World");
> {code}
> This workaround cannot be used in Ignite.NET clients since .NET 
> {{GetServiceProxy}} API does not support the service wait timeout, which is 
> hard-coded to 0 on the server side.
> h2. Full Exception in Discovery-Based Service Deployment Mode
> {noformat}
> [01:08:54,653][SEVERE][services-deployment-worker-#52][IgniteServiceProcessor]
>  Failed to initialize service (service will not be deployed): 
> IgniteTestService
> class org.apache.ignite.IgniteInterruptedException: Got interrupted while 
> waiting for future to complete.
>   at 
> 

[jira] [Commented] (IGNITE-12894) Cannot use IgniteAtomicSequence in Ignite services

2020-04-27 Thread Mikhail Petrov (Jira)


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

Mikhail Petrov commented on IGNITE-12894:
-

Hi,  [~daradurvs]. Thank you for clarification.

After some researches, I found that 
[GridServiceProxy#invokeMethod|https://github.com/apache/ignite/blob/8cba313c9961b16e358834216e9992310f285985/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java#L149]
 already has a similar mechanism as you mentioned.
 But it doesn't work correctly for the time being.

[GridServiceProxy#invokeMethod|https://github.com/apache/ignite/blob/8cba313c9961b16e358834216e9992310f285985/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java#L149]
 assumes that if 
[GridServiceProxy#waitTimeout|https://github.com/apache/ignite/blob/8cba313c9961b16e358834216e9992310f285985/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java#L93]
 equals 0 (e.g. we use 
[IgniteServices#serviceProxy|https://github.com/apache/ignite/blob/8cba313c9961b16e358834216e9992310f285985/modules/core/src/main/java/org/apache/ignite/IgniteServices.java#L592]
 for proxy obtaining) then waiting time is not limited at all.
 But at the same time, 
[IgniteServiceProcessor#serviceTopology|https://github.com/apache/ignite/blob/8cba313c9961b16e358834216e9992310f285985/modules/core/src/main/java/org/apache/ignite/internal/processors/service/IgniteServiceProcessor.java#L807]
 assumes that if timeout argument equals 0 then NO waiting
 is needed. The same is for 
[GridServiceProcessor#serviceTopology|https://github.com/apache/ignite/blob/8cba313c9961b16e358834216e9992310f285985/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java#L907].

Even if the behavior described above is considered valid, 
[GridServiceProxy#invokeMethod|https://github.com/apache/ignite/blob/8cba313c9961b16e358834216e9992310f285985/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java#L169]
 throws an exception that is not ignored in case no node for the service was 
found. So no repeated attempts will be made.

So I propose to make 
[IgniteServiceProcessor#serviceTopology|https://github.com/apache/ignite/blob/8cba313c9961b16e358834216e9992310f285985/modules/core/src/main/java/org/apache/ignite/internal/processors/service/IgniteServiceProcessor.java#L807]
 wait infinitely if timeout equals to 0.
 In case of using IgniteServiceProcessor, it helps to avoid using busy-wait 
loop for topology obtaining. And solves the following scenarios:
 * proxy obtaining method is called on node that did not receive service 
registration message
 * service is registered  but service initialization or coordinator full 
message awaiting was not completed

WDYT?

> Cannot use IgniteAtomicSequence in Ignite services
> --
>
> Key: IGNITE-12894
> URL: https://issues.apache.org/jira/browse/IGNITE-12894
> Project: Ignite
>  Issue Type: Bug
>  Components: compute
>Affects Versions: 2.8
>Reporter: Alexey Kukushkin
>Assignee: Mikhail Petrov
>Priority: Major
>  Labels: sbcf
>
> h2. Repro Steps
> Execute the below steps in default service deployment mode and in 
> discovery-based service deployment mode. 
>  Use {{-DIGNITE_EVENT_DRIVEN_SERVICE_PROCESSOR_ENABLED=true}} JVM option to 
> switch to the discovery-based service deployment mode.
>  * Create a service initializing an {{IgniteAtomicService}} in method 
> {{Service#init()}} and using the {{IgniteAtomicService}} in a business method.
>  * Start an Ignite node with the service specified in the IgniteConfiguration
>  * Invoke the service's business method on the Ignite node
> h3. Actual Result
> h4. In Default Service Deployment Mode
> Deadlock on the business method invocation
> h4. In Discovery-Based Service Deployment Mode
> The method invocation fails with {{IgniteException: Failed to find deployed 
> service: IgniteTestService}}
> h2. Reproducer
> h3. Test.java
> {code:java}
> public interface Test {
> String sayHello(String name);
> }
> {code}
> h3. IgniteTestService.java
> {code:java}
> public class IgniteTestService implements Test, Service {
> private @IgniteInstanceResource Ignite ignite;
> private IgniteAtomicSequence seq;
> @Override public void cancel(ServiceContext ctx) {
> }
> @Override public void init(ServiceContext ctx) throws 
> InterruptedException {
> seq = ignite.atomicSequence("TestSeq", 0, true);
> }
> @Override public void execute(ServiceContext ctx) {
> }
> @Override public String sayHello(String name) {
> return "Hello, " + name + "! #" + seq.getAndIncrement();
> }
> }
> {code}
> h3. 

[jira] [Commented] (IGNITE-12894) Cannot use IgniteAtomicSequence in Ignite services

2020-04-24 Thread Vyacheslav Daradur (Jira)


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

Vyacheslav Daradur commented on IGNITE-12894:
-

Both issues: this and IGNITE-12490 can be fixed by improvements of our 
deployment guarantees, read this for details: 
[dev-list-thread|http://apache-ignite-developers.2346864.n4.nabble.com/Discovery-based-services-deployment-guarantees-question-td44866.html]

The main idea is allowing 
[GridServiceProxy#randomNodeForService|https://github.com/apache/ignite/blob/8cba313c9961b16e358834216e9992310f285985/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java#L283]
 to wait service deployment finished if it is registered in the cluster (but 
deployment has not finished yet).

It can be achieved in the same manner as for our ["API with a timeout" 
here|https://github.com/apache/ignite/blob/8dcd0f1d96dae965a0f5c479e6d0f4b4d50c6e2c/modules/core/src/main/java/org/apache/ignite/internal/processors/service/IgniteServiceProcessor.java#L821http://example.com]
 (mentioned as a workaround in current issue description).

Need add some conditions, something like this:
{code:java}
IgniteUuid srvcUid = lookupRegisteredServiceId(name);

if (srvcUid == null)
return null; // Service is not registered in cluster: wasn't 
present in cfg and didn't deployed through API

Map top;

while (true) {
ServiceInfo srvcDesc = registeredServices.get(srvcUid);

if (srvcDesc == null) {
if (timeout == 0)
return null;
else
// Wait if someone sent service to deploy (as in current 
implementation)
}

top = srvcDesc.topologySnapshot();

if (!top.isEmpty()) {
return top;
}

// Wait using "servicesTopsUpdateMux" while service deployment 
finished and the topology will not be empty
// or removed from "registeredServices" in case if deployment 
failure
{code}

> Cannot use IgniteAtomicSequence in Ignite services
> --
>
> Key: IGNITE-12894
> URL: https://issues.apache.org/jira/browse/IGNITE-12894
> Project: Ignite
>  Issue Type: Bug
>  Components: compute
>Affects Versions: 2.8
>Reporter: Alexey Kukushkin
>Assignee: Mikhail Petrov
>Priority: Major
>  Labels: sbcf
>
> h2. Repro Steps
> Execute the below steps in default service deployment mode and in 
> discovery-based service deployment mode. 
>  Use {{-DIGNITE_EVENT_DRIVEN_SERVICE_PROCESSOR_ENABLED=true}} JVM option to 
> switch to the discovery-based service deployment mode.
>  * Create a service initializing an {{IgniteAtomicService}} in method 
> {{Service#init()}} and using the {{IgniteAtomicService}} in a business method.
>  * Start an Ignite node with the service specified in the IgniteConfiguration
>  * Invoke the service's business method on the Ignite node
> h3. Actual Result
> h4. In Default Service Deployment Mode
> Deadlock on the business method invocation
> h4. In Discovery-Based Service Deployment Mode
> The method invocation fails with {{IgniteException: Failed to find deployed 
> service: IgniteTestService}}
> h2. Reproducer
> h3. Test.java
> {code:java}
> public interface Test {
> String sayHello(String name);
> }
> {code}
> h3. IgniteTestService.java
> {code:java}
> public class IgniteTestService implements Test, Service {
> private @IgniteInstanceResource Ignite ignite;
> private IgniteAtomicSequence seq;
> @Override public void cancel(ServiceContext ctx) {
> }
> @Override public void init(ServiceContext ctx) throws 
> InterruptedException {
> seq = ignite.atomicSequence("TestSeq", 0, true);
> }
> @Override public void execute(ServiceContext ctx) {
> }
> @Override public String sayHello(String name) {
> return "Hello, " + name + "! #" + seq.getAndIncrement();
> }
> }
> {code}
> h3. Reproducer.java
> {code:java}
> public class Reproducer {
> public static void main(String[] args) {
> IgniteConfiguration igniteCfg = new IgniteConfiguration()
> .setServiceConfiguration(
> new ServiceConfiguration()
> .setName(IgniteTestService.class.getSimpleName())
> .setMaxPerNodeCount(1)
> .setTotalCount(0)
> .setService(new IgniteTestService())
> )
> .setDiscoverySpi(
> new TcpDiscoverySpi()
> .setIpFinder(new 
> TcpDiscoveryVmIpFinder().setAddresses(Collections.singleton("127.0.0.1:47500")))
> );
> try (Ignite ignite = Ignition.start(igniteCfg)) {
> 
> 

[jira] [Commented] (IGNITE-12894) Cannot use IgniteAtomicSequence in Ignite services

2020-04-14 Thread Alexey Kukushkin (Jira)


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

Alexey Kukushkin commented on IGNITE-12894:
---

Might be related to IGNITE-12490

> Cannot use IgniteAtomicSequence in Ignite services
> --
>
> Key: IGNITE-12894
> URL: https://issues.apache.org/jira/browse/IGNITE-12894
> Project: Ignite
>  Issue Type: Bug
>  Components: compute
>Affects Versions: 2.8
>Reporter: Alexey Kukushkin
>Assignee: Alexey Kukushkin
>Priority: Major
>  Labels: sbcf
>
> h2. Repro Steps
> Execute the below steps in default service deployment mode and in 
> discovery-based service deployment mode. 
>  Use {{-DIGNITE_EVENT_DRIVEN_SERVICE_PROCESSOR_ENABLED=true}} JVM option to 
> switch to the discovery-based service deployment mode.
>  * Create a service initializing an {{IgniteAtomicService}} in method 
> {{Service#init()}} and using the {{IgniteAtomicService}} in a business method.
>  * Start an Ignite node with the service specified in the IgniteConfiguration
>  * Invoke the service's business method on the Ignite node
> h3. Actual Result
> h4. In Default Service Deployment Mode
> Deadlock on the business method invocation
> h4. In Discovery-Based Service Deployment Mode
> The method invocation fails with {{IgniteException: Failed to find deployed 
> service: IgniteTestService}}
> h2. Reproducer
> h3. Test.java
> {code:java}
> public interface Test {
> String sayHello(String name);
> }
> {code}
> h3. IgniteTestService.java
> {code:java}
> public class IgniteTestService implements Test, Service {
> private @IgniteInstanceResource Ignite ignite;
> private IgniteAtomicSequence seq;
> @Override public void cancel(ServiceContext ctx) {
> }
> @Override public void init(ServiceContext ctx) throws 
> InterruptedException {
> seq = ignite.atomicSequence("TestSeq", 0, true);
> }
> @Override public void execute(ServiceContext ctx) {
> }
> @Override public String sayHello(String name) {
> return "Hello, " + name + "! #" + seq.getAndIncrement();
> }
> }
> {code}
> h3. Reproducer.java
> {code:java}
> public class Reproducer {
> public static void main(String[] args) {
> IgniteConfiguration igniteCfg = new IgniteConfiguration()
> .setServiceConfiguration(
> new ServiceConfiguration()
> .setName(IgniteTestService.class.getSimpleName())
> .setMaxPerNodeCount(1)
> .setTotalCount(0)
> .setService(new IgniteTestService())
> )
> .setDiscoverySpi(
> new TcpDiscoverySpi()
> .setIpFinder(new 
> TcpDiscoveryVmIpFinder().setAddresses(Collections.singleton("127.0.0.1:47500")))
> );
> try (Ignite ignite = Ignition.start(igniteCfg)) {
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false)
> .sayHello("World");
> }
> }
> }
> {code}
> h2. Workaround
> Specifying a service wait timeout solves the problem in the discovery-based 
> service deployment mode (but not in the default deployment mode):
> {code:java}
> 
> ignite.services().serviceProxy(IgniteTestService.class.getSimpleName(), 
> Test.class, false, 1_000)
> .sayHello("World");
> {code}
> This workaround cannot be used in Ignite.NET clients since .NET 
> {{GetServiceProxy}} API does not support the service wait timeout, which is 
> hard-coded to 0 on the server side.
> h2. Full Exception in Discovery-Based Service Deployment Mode
> {noformat}
> [01:08:54,653][SEVERE][services-deployment-worker-#52][IgniteServiceProcessor]
>  Failed to initialize service (service will not be deployed): 
> IgniteTestService
> class org.apache.ignite.IgniteInterruptedException: Got interrupted while 
> waiting for future to complete.
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:888)
>   at 
> org.apache.ignite.internal.util.IgniteUtils$3.apply(IgniteUtils.java:886)
>   at 
> org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:1062)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3999)
>   at 
> org.apache.ignite.internal.IgniteKernal.atomicSequence(IgniteKernal.java:3985)
>   at Sandbox.Net.IgniteTestService.init(IgniteTestService.java:17)
>   at 
> org.apache.ignite.internal.processors.service.IgniteServiceProcessor.redeploy(IgniteServiceProcessor.java:1188)
>   at 
> org.apache.ignite.internal.processors.service.ServiceDeploymentTask.lambda$processDeploymentActions$5(ServiceDeploymentTask.java:318)
>   at