Increase max message size in Daml Studio
- georgOP 1
I’m getting the following error in Daml Studio:
"Scenario service backend error: BErrorClient (ClientIOError (GRPCIOBadStatusCode StatusResourceExhausted (StatusDetails {unStatusDetails = \"Received message larger than max (4455861 vs. 4194304)\"Is there a way to increase that limit for the scenario service in Daml Studio?
- cocreature 2
You can! Documented in Daml Assistant (daml) — Daml SDK 1.18.0 documentation
Inlining the relevant section of
daml.yaml:scenario-service: grpc-max-message-size: yourmaxmessagesizehere - georg
Does this indeed affect the in-IDE scenario service used in Daml Studio? Cause I don’t see the error message go away or change when setting this in
daml.yaml. Or does it require SDK v1.8.0 to work? - cocreature
It has been there for a while, haven’t checked the exact version but definitely the last year or so.
You do need to restart the IDE scenario service via Control-Shift-P reload window to have it be picked up.
- georg
Double-checked, it doesn’t seem to resolve the issue. The error does seem related to the overall complexity of my test script (or particular
doblocks), not to a single submission of a particularly complex transaction. I vaguely remember having hit that previously, where you suggested I might have to split my script into smaller chunks as the only possible option. Do you remember maybe, am I hitting a different limit than what’s being set with this parameter? - cocreature
The long script can result in nesting errors but not in max message size issues. Would it be possible to share your project?
- georg
Shared in private due to large project size
- georg
I also noticed the following: the documentation says
grpc-max-message-size: ... If unspecified this defaults to 128MB (134217728 bytes)But my error message seems to suggest there’s a different default:
"...Received message larger than max (4455861 vs. 4194304)"I’m not sure what’s going on here.
- cocreature 5
This turned out to be a bug. The setting applied for messages sent towards the script service (primarily your code) but not towards messages coming back from the script service (the list of transactions). Fixed in Apply grpc-max-message-size in both directions in the script service by cocreature · Pull Request #12149 · digital-asset/daml · GitHub.
That said, the example is so large that viewing the script results in Daml Studio is pretty slow and it’s impossible to understand anything so I’d still recommend to try to split it up.
- brijg11
HI DAH team
I am facing this issue and tried different values for grpc-max-message-size in daml.yaml without success with daml 1.18.1 and daml test.
Which version of daml has this fix? and is there anything I can do without having to change the daml sdk version. - cocreature
The fix is in SDK 2.0 and newer. There is no real workaround for older versions apart from trying to shorten your scenario to ensure that you don’t exceed the message size so my recommendation is to upgrade.
- Turan
This is still occurring with both the 2.1.0 and 2.0.0 plugin/sdk the config in daml.yaml is not being respected by the plugin when trying to run “Script results”
daml.yaml (tried with both script-service & scenario-service)
scenario-service: grpc-max-message-size: 134217728Error in vscode
"Scenario service backend error: BErrorClient (ClientIOError (GRPCIOBadStatusCode StatusResourceExhausted (StatusDetails {unStatusDetails = \"Received message larger than max (4638343 vs. 4194304)\"})))" - cocreature
can you share code to reproduce this?
- Turan
Of the config not being respected or the actual script? because for the first you can see in the error message that the config in daml.yaml is not respected by the plugin unless it derives its max from another config value we haven’t put?
- cocreature
The actual script that exceeds the limit.
- Turan
Sure here’s a random example
module Count where import Daml.Script template Count with owner: Party value: Int where signatory owner observer owner example : Script () example = do human <- allocatePartyWithHint "Human" (PartyIdHint "Human") humanId <- validateUserId "human" createUser (User humanId (Some human)) [CanActAs human] forA [0..10000] $ \p -> submit human do createCmd Count with owner = human, value = p pure() - akrmn 1
Hi @Turan, thank you for providing the script. I haven’t been able to reproduce your error directly; in my setup I get a timeout instead:
"Scenario service backend error: BErrorClient (ClientIOError (GRPCIOBadStatusCode StatusDeadlineExceeded (StatusDetails {unStatusDetails = \"Deadline Exceeded\"})))"However, I was able to get the expected
Received message larger than maxerror by tweaking your script to produce a single large contract rather than 10000 small ones,module Count where import Daml.Script template Count with owner: Party values: [Int] where signatory owner observer owner example : Script () example = do human <- allocatePartyWithHint "Human" (PartyIdHint "Human") humanId <- validateUserId "human" createUser (User humanId (Some human)) [CanActAs human] submit human do createCmd Count with owner = human, values = replicate 1500000 1 pure()# daml.yaml sdk-version: 2.1.0 name: count version: 1.0.0 source: Count.daml dependencies: - daml-prim - daml-stdlib - daml-scriptSoon after clicking on the Script results action, I got the expected error message,
"Scenario service backend error: BErrorClient (ClientIOError (GRPCIOBadStatusCode StatusResourceExhausted (StatusDetails {unStatusDetails = \"Received message larger than max (6000340 vs. 4194304)\"})))"Then, I applied the solution offered by @cocreature, namely adding the following two lines to the bottom of the
daml.yamlfile and restarting the script service withCtrl/Cmd-Shift-P, Reload Windowscript-service: grpc-max-message-size: 6000340This time around, the Script results action completed successfully and showed me the ledger with a single large contract.
Now, this makes me think that you either need to make sure to reload the Daml Studio/VS Code window so the changes to your
daml.yamlfile take effect, or that maybe yourdaml.yamlfile is somehow being completely ignored (though I would need to know more about your project structure to look into this).tl;dr: please try reloading the Daml Studio window (
Ctrl/Cmd-Shift-P, Reload Window) after changing thedaml.yamlfile