Version 4

    Analysis

    Summary

    Today, when an operation or command takes too long, the CLI is stuck during the whole command duration, there is no way to bound the command execution time. There is currently a timeout option but it only applies to connection.

    Requirements

    • Allow user to provide a timeout value.
    • Allow user to adjust the timeout value according to the command (e.g.: batch would need a longer timeout than non batch command).
    • Setting the timeout inside a batch is not applicable. The batch as a whole is subject to the timeout.
    • Command are interrupted and can be stopped (according to the command implementation).
    • A timeout == 0 means no timeout.
    • When timeout occurs, an explicit message must be displayed and the next command can be executed.
    • In interactive mode, the prompt must be displayed after a timeout for the user to type the next command.
    • No resource must be leaked after timeouts.
    • Timeout applies to each individual command, the timeout is being restored to its value after each executed command.

    Design Notes

    • Add a new XML element and option --command-timeout to the CLI. This should be mainly used in non interactive mode.
    • By default no timeout is set, the timeout default value is 0.
    • Introduce a new command timeout to set, get and reset the timeout.
    • timeout get ⇒ displays the timeout.
    • timeout set {num_seconds} ⇒ set the timeout
    • timeout reset config ⇒ set the timeout to its config value
    • timeout reset default ⇒ set the timeout to its default value (no timeout)

    Documentation

    Command Timeout

    By default CLI command and operation executions are not timely bounded. It means that never ending execution of a command will make the CLI process to be stuck and unresponsive.

    To protect the CLI from this behavior, one can set a command execution timeout.

     

    Command Timeout behavior

    In interactive mode, when a timeout occurs, an error message is displayed then the console prompt is made available to type new commands.

    In non interactive mode (executing a script or a list of commands), when a timeout occurs, an exception is thrown and the CLI execution is stopped.

    In both modes (interactive and non interactive), when a timeout occurs, the CLI will make a best effort to cancel the associated server side activities.

     

    Configuring the Command timeout

    - Add the XML element <command-timeout>{num seconds}</command-timeout> to the CLI XML configuration file.

    - Add the option --command-timeout={num seconds} to the CLI command line. This will override any value set in the XML configuration file.

    Managing the Command Timeout

    Once the CLI is running, the timeout can be adjusted to cope with the commands to execute. For example, a batch command will need a longer timeout than a non batch one. The command command-timeout allows to get, set and reset the command timeout.

     

    Retrieving the command timeout

    The command command-timeout get displays the current timeout in seconds. A timeout of 0 means no timeout.

    [standalone@localhost:9990 /] command-timeout get

    0

     

    Setting the command timeout

    The command command-timeout set update the timeout value to a number of seconds. If a timeout has been set via configuration (XML file or option), it is overridden by the set action.

    [standalone@localhost:9990 /] command-timeout set 10

     

    Resetting the command timeout

    The command command-timeout reset {config|default} allows to set the timeout to its configuration value (XML file or option) or default value (0 second). If no configuration value is set, resetting to the configuration value sets the timeout to its default value (0 seconds).

     

     

    [standalone@localhost:9990 /] command-timeout reset config

    [standalone@localhost:9990 /] command-timeout reset default


    General

    Product Issue(s)

    https://issues.jboss.org/browse/EAP7-517

    Upstream Issue(s)

    https://issues.jboss.org/browse/WFCORE-923


    Developer Contacts

    Alexey Loubyansky (alexey.loubyansky@redhat.com)

    Jean-François Denise (jdenise@redhat.com)