[ 
https://issues.apache.org/jira/browse/IGNITE-28229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vyacheslav Koptilin updated IGNITE-28229:
-----------------------------------------
    Description: 
Let's take a look at `org.apache.ignite.internal.Cluster`:
{code:java}
/**
 * Starts a cluster node.
 *
 * @param testInfo Test info.
 * @param nodeIndex Index of the node to start.
 * @param nodeBootstrapConfigTemplate Bootstrap config template to use for this 
node.
 * @param nodeBootstrapConfigUpdater Boot configuration updater before starting 
the node.
 * @return Started server and its registration future.
 */
public ServerRegistration startEmbeddedNode(
        @Nullable TestInfo testInfo,
        int nodeIndex,
        String nodeBootstrapConfigTemplate,
        NodeBootstrapConfigUpdater nodeBootstrapConfigUpdater
) {
    ...
    IgniteServer node = clusterConfiguration.usePreConfiguredStorageProfiles()
            ? TestIgnitionManager.start(
                    nodeName,
                    config,
                    
clusterConfiguration.workDir().resolve(clusterConfiguration.clusterName()).resolve(nodeName))
            : TestIgnitionManager.startWithoutPreConfiguredStorageProfiles(
                    nodeName,
                    config,
                    
clusterConfiguration.workDir().resolve(clusterConfiguration.clusterName()).resolve(nodeName));

    synchronized (igniteServers) {
        setListAtIndex(igniteServers, nodeIndex, node);
    }

    CompletableFuture<Void> registrationFuture = 
node.waitForInitAsync().thenRun(() -> {
        synchronized (nodes) {
            setListAtIndex(nodes, nodeIndex, node.api());
        }

        if (stopped) {
            // Make sure we stop even a node that finished starting after the 
cluster has been stopped.
            node.shutdown();
        }
    });

    return new ServerRegistration(node, registrationFuture);
}{code}
Let's assume that `TestIgnitionManager.start` hangs for some reason, and the 
current thread (which executes `startEmbeddedNode) is interrupted. In this 
case, the starting node is not registered as a part of `igniteServers` and 
`nodes`, however, it does not interrupt the process of starting itself. 
Therefore, we can end up with the stale node, which in turn may affect other 
tests.

  was:
Let's take a look at `org.apache.ignite.internal.Cluster`:
{code:java}
/**
 * Starts a cluster node.
 *
 * @param testInfo Test info.
 * @param nodeIndex Index of the node to start.
 * @param nodeBootstrapConfigTemplate Bootstrap config template to use for this 
node.
 * @param nodeBootstrapConfigUpdater Boot configuration updater before starting 
the node.
 * @return Started server and its registration future.
 */
public ServerRegistration startEmbeddedNode(
        @Nullable TestInfo testInfo,
        int nodeIndex,
        String nodeBootstrapConfigTemplate,
        NodeBootstrapConfigUpdater nodeBootstrapConfigUpdater
) {
    ...
    IgniteServer node = clusterConfiguration.usePreConfiguredStorageProfiles()
            ? TestIgnitionManager.start(
                    nodeName,
                    config,
                    
clusterConfiguration.workDir().resolve(clusterConfiguration.clusterName()).resolve(nodeName))
            : TestIgnitionManager.startWithoutPreConfiguredStorageProfiles(
                    nodeName,
                    config,
                    
clusterConfiguration.workDir().resolve(clusterConfiguration.clusterName()).resolve(nodeName));

    synchronized (igniteServers) {
        setListAtIndex(igniteServers, nodeIndex, node);
    }

    CompletableFuture<Void> registrationFuture = 
node.waitForInitAsync().thenRun(() -> {
        synchronized (nodes) {
            setListAtIndex(nodes, nodeIndex, node.api());
        }

        if (stopped) {
            // Make sure we stop even a node that finished starting after the 
cluster has been stopped.
            node.shutdown();
        }
    });

    return new ServerRegistration(node, registrationFuture);
}{code}
Let's assume that `TestIgnitionManager.start` hangs for some reason, and the 
current thread (which executes `startEmbeddedNode) is interrupted. In this 
case, the starting node is not registered as a part of `igniteServers` and 
`nodes`, however, it does not prevent the process of starting itself. 
Therefore, we can end up with the stale node, that in turn may affect other 
tests.


> TestCluster might skip registration an Ignite node
> --------------------------------------------------
>
>                 Key: IGNITE-28229
>                 URL: https://issues.apache.org/jira/browse/IGNITE-28229
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Vyacheslav Koptilin
>            Priority: Major
>              Labels: MakeTeamcityGreenAgain, ignite-3
>
> Let's take a look at `org.apache.ignite.internal.Cluster`:
> {code:java}
> /**
>  * Starts a cluster node.
>  *
>  * @param testInfo Test info.
>  * @param nodeIndex Index of the node to start.
>  * @param nodeBootstrapConfigTemplate Bootstrap config template to use for 
> this node.
>  * @param nodeBootstrapConfigUpdater Boot configuration updater before 
> starting the node.
>  * @return Started server and its registration future.
>  */
> public ServerRegistration startEmbeddedNode(
>         @Nullable TestInfo testInfo,
>         int nodeIndex,
>         String nodeBootstrapConfigTemplate,
>         NodeBootstrapConfigUpdater nodeBootstrapConfigUpdater
> ) {
>     ...
>     IgniteServer node = clusterConfiguration.usePreConfiguredStorageProfiles()
>             ? TestIgnitionManager.start(
>                     nodeName,
>                     config,
>                     
> clusterConfiguration.workDir().resolve(clusterConfiguration.clusterName()).resolve(nodeName))
>             : TestIgnitionManager.startWithoutPreConfiguredStorageProfiles(
>                     nodeName,
>                     config,
>                     
> clusterConfiguration.workDir().resolve(clusterConfiguration.clusterName()).resolve(nodeName));
>     synchronized (igniteServers) {
>         setListAtIndex(igniteServers, nodeIndex, node);
>     }
>     CompletableFuture<Void> registrationFuture = 
> node.waitForInitAsync().thenRun(() -> {
>         synchronized (nodes) {
>             setListAtIndex(nodes, nodeIndex, node.api());
>         }
>         if (stopped) {
>             // Make sure we stop even a node that finished starting after the 
> cluster has been stopped.
>             node.shutdown();
>         }
>     });
>     return new ServerRegistration(node, registrationFuture);
> }{code}
> Let's assume that `TestIgnitionManager.start` hangs for some reason, and the 
> current thread (which executes `startEmbeddedNode) is interrupted. In this 
> case, the starting node is not registered as a part of `igniteServers` and 
> `nodes`, however, it does not interrupt the process of starting itself. 
> Therefore, we can end up with the stale node, which in turn may affect other 
> tests.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to