wildfly / wildfly-plugin-tools

A group of tools for interacting/managing with a WildFly container
Apache License 2.0
0 stars 2 forks source link

The `ServerManager.isRunning(ModelControllerClient)` fails if the server never runs #26

Closed jamezp closed 3 months ago

jamezp commented 5 months ago

The ServerManager.isRunning(ModelControllerClient) may time out if the server is never started. This seems to be showing up on Windows, but not Linux. However, looking at the source it does look incorrect:

static boolean isRunning(final ModelControllerClient client) {
    try {
        String launchType;
        while ((launchType = launchType(client).orElse(null)) != null) {
            if ("STANDALONE".equals(launchType)) {
                return CommonOperations.isStandaloneRunning(client);
            } else if ("DOMAIN".equals(launchType)) {
                return CommonOperations.isDomainRunning(client, false);
            }
        }
    } catch (RuntimeException e) {
        Logger.getLogger(ServerManager.class).trace("Interrupted determining if server is running", e);
    }
    return false;
}

If the launchType() method always returns null this method will forever run. That doesn't look right for cases when the server might really be down.