Server crash when ignite service is stopped on client node
- Dominant language
- Java
- Stars
- 5.1k
- Forks
- 1.9k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
There is a cluster of 3 nodes. 1 server and 2 client nodes. The server is started with ignite.bat without parameters. The 2 client nodes are running as part of my dotnet applications. One (N1) runs ignite services and the other (N2) is a console application to control the services in the cluster. I.e. for starting, stopping and controlling the services.
When on N2 I give a command to start a service - `services.DeployNodeSingleton("TestService", TestServiceImpl)`, everything is fine - the service is started on N1 and works. But when I give a command to stop the service - `services.Cancel("TestService")`, an exception occurs on the server and it crashes. At the same time `TestService` is successfully stopped on N1.
Error occurring on the server:
```
[12:42:31,848][SEVERE][services-deployment-worker-#74%main-grid%][ServiceDeploymentTask] Error occurred while initializing deployment task, err=Cannot invoke "org.apache.ignite.internal.processors.service.ServiceInfo.name()" because "rmv" is null
java.lang.NullPointerException: Cannot invoke "org.apache.ignite.internal.processors.service.ServiceInfo.name()" because "rmv" is null
at org.apache.ignite.internal.processors.service.IgniteServiceProcessor.lambda$updateDeployedServices$4(IgniteServiceProcessor.java:1599)
at java.base/java.util.HashMap.forEach(HashMap.java:1421)
at java.base/java.util.Collections$UnmodifiableMap.forEach(Collections.java:1553)
at org.apache.ignite.internal.processors.service.IgniteServiceProcessor.updateDeployedServices(IgniteServiceProcessor.java:1594)
...
```
I looked at the source code for the void `updateDeployedServices(final ServiceDeploymentActions depActions)` method in the modules/core/src/main/java/org/apache/ignite/internal/processors/service/IgniteServiceProcessor.java file. In the `ServiceInfo` line `rmv = deployedServices.remove(srvcId);` the `deployedServices.remove(srvcId)` method probably returns null and this is not handled in any way so an exception is thrown on `deployedServicesByName.remove(rmv.name())`
Contributor guide
Research direction
Start in modules/core/src/main/java/org/apache/ignite/internal/processors/service/IgniteServiceProcessor.java, focusing on updateDeployedServices and the stack trace around lines 1594-1599. Reproduce deployment from one client and cancellation from another against a server, then verify that cancellation completes without a server exception or crash and that the service is still stopped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100