Invalid ledger time

I got the following error when submitting a command while the sandbox ledger is busy.

13:56:17.048 [qtp1316540694-19] INFO c.a.d.t.CommandCompletionHelper [ : - ] - Command Submission - Ref: takesometimeZ01-4 Command ID: 80e0d0f4-fc1c-4f79-ac44-d0c3afb5f960
13:57:17.769 [qtp1316540694-19] INFO c.a.d.t.CommandCompletionHelper [ : - ] - Submission Result: OK for Command id: 80e0d0f4-fc1c-4f79-ac44-d0c3afb5f960
13:57:26.086 [client-1] INFO c.a.d.t.CommandCompletionHelper [ : - ] - Completion ERROR for cid:80e0d0f4-fc1c-4f79-ac44-d0c3afb5f960/party:EUR_Bank - Status:Status{code=ABORTED, description=null, cause=null}/Invalid ledger time: Record time 2020-08-12T03:56:17.348Z outside of range [2020-08-12T03:55:47.348Z, 2020-08-12T03:56:47.348Z]

The error message says “Record time 2020-08-12T03:56:17.348Z outside of range [2020-08-12T03:55:47.348Z, 2020-08-12T03:56:47.348Z].” It looks like it is within the range… Did I miss anything here?

2 Likes

Unfortunately, there’s a bug in this error message. It was fixed in this pull request: Fix time model error message by rautenrieth-da · Pull Request #6813 · digital-asset/daml · GitHub

This fix is in the latest snapshots and will be part of DAML SDK v1.4.0, to be released later today, so I’d recommend upgrading to that.

In the mean time, you can assume that the ledger time is not within the bounds, and that the error message is misleading.

To mitigate this, we recommend easing off on the ledger. You can adjust the --max-commands-in-flight flag to a lower value than the default in order to signal that the clients should back off by sending a RESOURCE_EXHAUSTED error.

You can also potentially speed up each transaction by specifying a cache size for deserialization with the --max-lf-value-translation-cache-entries flag. We have found in testing that setting this to, for example, 1024 helps a lot with lots of large, similar transactions.

It’s worth remembering that Sandbox is not a production-ready ledger and is not expected to work with large volumes. It’s for development and testing. You may have better luck with a more robust ledger, such as DAML on VMware, DAML on Corda, or DAML on SQL. There are lots of options on the Digital Asset website.

3 Likes

One common source for this issue is a transaction where interpretation or validation takes a long time. This can happen even if you only have a send a single command and if it’s the first command caching won’t help either.

But there are some ways to make that work, take a look at the end of https://docs.daml.com/1.4.0-snapshot.20200729.4851.0.224ab362/concepts/time.html#assigning-ledger-time and Semantics of min_ledger_time for more information on this.

2 Likes

SDK 1.4.0 is out @Frankie :slight_smile:

daml install latest to get it

4 Likes