Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/Command service timeoutForum ↗

Command service timeout

App Development6 posts544 views16 likesLast activity May 2020
GE
georgOP
Apr 2020 4

Will the (synchronous) Command Service timeout a command if for example the completion is lost? If yes:

  • What will the service return to the synchronous client call?
  • What is the default timeout set?
  • Can this be configured?
GE
gerolf
Apr 2020 6
  • The CommandService returns with an error ABORTED for tracked commands without a result from the ledger within the deduplication window.
  • The default deduplication window is 24h.
  • This window can be customized for each request via the Commands#deduplication_time field.
DA
daniel
May 2020 1

HI @gerolf ,

Thanks for the explanation. I was looking for similar info.

One question though:
We are using ledger-api-client, per the source code, how is the defaultDeduplicationTime 30s (see below) differs to the 24h you mentioned above?

Thanks,
Daniel

/**
  * @param maxCommandsInFlight The maximum number of unconfirmed commands the client may track.
  *                            The client will backpressure when this number is reached.
  * @param maxParallelSubmissions The maximum number of parallel command submissions at a given time.
  *                               The client will backpressure when this number is reached.
  * @param defaultDeduplicationTime The deduplication time to use for commands that do not have
  *                                 a deduplication time set. The deduplication time is also used
  *                                 as the time after which commands time out in the command client.
  */
final case class CommandClientConfiguration(
    maxCommandsInFlight: Int,
    maxParallelSubmissions: Int,
    defaultDeduplicationTime: Duration,
)

object CommandClientConfiguration {
  def default = CommandClientConfiguration(1, 1, Duration.ofSeconds(30L))
}
GE
gerolf
May 2020 2

The 24h default value on the Ledger is only used if the client doesn’t set a deduplication time. In this case, the client sets this parameter to 30s, so this is what will be used.

DA
daniel
May 2020

Thanks @gerolf.

So I studied the code a bit more. Is it correct to say that there are two kind of command client (provided in the ledger-api-client..jar

  1. commandClient
  2. synchrounousCommandClient

as shown in code below

  val commandClient: CommandClient =
    new CommandClient(
      LedgerClient.stub(CommandSubmissionServiceGrpc.stub(channel), config.token),
      LedgerClient.stub(CommandCompletionServiceGrpc.stub(channel), config.token),
      ledgerId,
      config.applicationId,
      config.commandClient
    )

  val commandServiceClient: SynchronousCommandClient =
    new SynchronousCommandClient(LedgerClient.stub(CommandServiceGrpc.stub(channel), config.token))

The config referenced about (Command service timeout) is applicabel tot he commandClient

where if I were using the commandServiceClient: SynchronousCommandClient
then two kind of deduplication can be configured

  1. dedup specifed in Commands (https://docs.daml.com/app-dev/grpc/proto-docs.html#commands)
  2. otherwise, default value (e.g. 24 hour as you mentioned)
    In this case, the defaultDeduplicationTime as specified on the CommandClientConfiguration is irrelevant?
GE
gerolf
May 2020 3

CommandClient in the code snippet above basically does what the CommandService does on the Ledger API Server.

Your statements about SynchronousCommandClient are correct :+1:

← Back to Discussions