Skip to content
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

Stack overflow in KVUtils #5947

Closed
bame-da opened this issue May 12, 2020 · 2 comments
Closed

Stack overflow in KVUtils #5947

bame-da opened this issue May 12, 2020 · 2 comments
Assignees

Comments

@bame-da
Copy link
Contributor

bame-da commented May 12, 2020

The below DAML Model creates a stack overflow in kvutils if CreateN is called with a large count. Can be tested using the attached daml.yaml by running daml start in SDK 1.0.

This works in Sandbox Classic so I believe it's a kvutils issue, not an engine issue.

DAML:

daml 1.2
module Batch where
import Daml.Script
template B
  with
    p : Party
  where
    signatory p
    nonconsuming choice CreateN : () 
      with
        n : Int
      controller p
      do
        res <- forA [1..n] (\_ -> do
              create T with ..
          )
        return()
template T
  with
    p : Party
  where
    signatory p
t : Script () = do
  p <- allocateParty "p"
  b <- submit p do createCmd B with ..
  submit p do exerciseCmd b CreateN with n = 5000
  return ()  

daml.yaml:

sdk-version: 1.0.0
name: batch
source: daml
parties:
  - p
version: 0.0.1
init-script: Batch:t
dependencies:
  - daml-prim
  - daml-stdlib
  - daml-script
sandbox-options:
  - --wall-clock-time

stackoverflow:

...
	at com.daml.ledger.participant.state.kvutils.committing.Common$Commit.$anonfun$flatMap$1(Common.scala:43)
	at com.daml.ledger.participant.state.kvutils.committing.Common$Commit.$anonfun$flatMap$1(Common.scala:43)
	at com.daml.ledger.participant.state.kvutils.committing.Common$Commit.$anonfun$flatMap$1(Common.scala:43)
...
@fabiotudone-da
Copy link
Contributor

This should be fixed by #5901 but the self-contained DAML code that reproduces it should allow us to write an actual test case for it, which we should do.

@bame-da
Copy link
Contributor Author

bame-da commented May 12, 2020

I can confirm that this is fixed in HEAD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants