-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FISH-898 Added timeout option to instance commands #5630
Conversation
jenkins test please |
jenkins test please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have issues with this.
I argue that this should also cover StartLocalInstanceCommand
, StopLocalInstanceCommand
, and RestartLocalInstanceCommand
- they also manage the lifecycle of an instance.
I also argue that the restart-cluster
, start-cluster
, and stop-cluster
commands should also have the timeout option.
I also think the way the start-instance
command does it is a bit nicer (sidenote, we now have two different impls of how to perform a timeout) - utlising the internal managed executor service to wait after executing the command rather than spinning up a standalone unmanaged thread and executing the entire command within that.
@Inject
private PayaraExecutorService executor;
...
/**
* Poll for the specified amount of time to check if the instance is running.
* Returns whether the instance was started before the timeout.
*
* @return true if the instance started up, or false otherwise.
*/
private boolean pollForLife(Server instance) {
// Start a new thread to check when the instance has started
CountDownLatch instanceTimeout = new CountDownLatch(1);
ScheduledFuture<?> instancePollFuture = executor.scheduleWithFixedDelay(() -> {
if (instance.isRunning()) {
instanceTimeout.countDown();
}
}, 500, 500, MILLISECONDS);
// If the timeout is reached, the instance isn't started so return false
try {
instanceTimeout.await(timeout, SECONDS);
} catch (InterruptedException e) {
return false;
} finally {
instancePollFuture.cancel(true);
}
return true;
}
Also the restart-instance command timeout probably isn't working as expected. It seems to say the instance restarted successfully even if it hasn't actually restarted yet.
Running the below it reports that the instance was restarted successfully before the instance was even shut down.
restart-instance --timeout 1 Tender-Carp
Tender-Carp was restarted.
Command restart-instance executed successfully.
...s/cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/RestartClusterCommand.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've still got competing timeouts
...us/cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/ClusterCommandHelper.java
Show resolved
Hide resolved
...s/cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/RestartClusterCommand.java
Outdated
Show resolved
Hide resolved
.../cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/RestartInstanceCommand.java
Outdated
Show resolved
Hide resolved
...ster/cli/src/main/java/com/sun/enterprise/admin/cli/cluster/RestartLocalInstanceCommand.java
Outdated
Show resolved
Hide resolved
...cluster/cli/src/main/java/com/sun/enterprise/admin/cli/cluster/StopLocalInstanceCommand.java
Outdated
Show resolved
Hide resolved
...cluster/cli/src/main/java/com/sun/enterprise/admin/cli/cluster/StopLocalInstanceCommand.java
Show resolved
Hide resolved
...ster/cli/src/main/java/com/sun/enterprise/admin/cli/cluster/RestartLocalInstanceCommand.java
Show resolved
Hide resolved
nucleus/cluster/admin/src/main/java/fish/payara/admin/cluster/StopDeploymentGroupCommand.java
Outdated
Show resolved
Hide resolved
jenkins test please |
...us/cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/ClusterCommandHelper.java
Outdated
Show resolved
Hide resolved
...s/cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/RestartClusterCommand.java
Outdated
Show resolved
Hide resolved
...s/cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/RestartClusterCommand.java
Show resolved
Hide resolved
...us/cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/ClusterCommandHelper.java
Show resolved
Hide resolved
...eus/cluster/admin/src/main/java/com/sun/enterprise/v3/admin/cluster/StartClusterCommand.java
Show resolved
Hide resolved
nucleus/cluster/admin/src/main/java/fish/payara/admin/cluster/StartDeploymentGroupCommand.java
Show resolved
Hide resolved
nucleus/cluster/admin/src/main/java/fish/payara/admin/cluster/StopDeploymentGroupCommand.java
Show resolved
Hide resolved
...us/admin/util/src/main/java/com/sun/enterprise/admin/util/TimeoutParamDefaultCalculator.java
Outdated
Show resolved
Hide resolved
...in/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/cli/LocalServerCommand.java
Outdated
Show resolved
Hide resolved
nucleus/admin/cli/src/main/java/com/sun/enterprise/admin/cli/remote/RemoteCLICommand.java
Outdated
Show resolved
Hide resolved
jenkins test please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing man page updates:
- stop-local-instance.1
- restart-local-instance.1
- start-local-instance.1
- stop-instance.1
- restart-instance.1
- start-instance.1
- stop-cluster.1
- start-cluster.1
Jenkins test please |
Description
Added
--timeout
optionImportant Info
Blockers
N/A
Testing
New tests
N/A
Testing Performed
Built Payara and tested timeout
Testing Environment
ubuntu 20.04 maven 3.6.3 openjdk version "1.8.0_302"
Documentation
payara/Payara-Community-Documentation#296
Notes for Reviewers