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

Sequencing a big number of futures crashes the ParT #1

Open
kikofernandez opened this issue Aug 16, 2017 · 0 comments
Open

Sequencing a big number of futures crashes the ParT #1

kikofernandez opened this issue Aug 16, 2017 · 0 comments

Comments

@kikofernandez
Copy link
Owner

The following example crashes the ParT:

import Task
import ParT.ParT

read class MyObject
  val id : int = 0

  def init(id: int): unit
    this.id = id
  end

  def value(): int
    this.id
  end

  def inc(): uint
    EMBED (uint)
      // safely cheating to increment the counter
      #{this.id} = #{this.id} + 1;
    END
  end
end


fun generateObjects(number: uint): Par[int]
  var p = empty[MyObject]()
  for i <- [0..number] do
    p = p ||| liftf(async(new MyObject(i)))
  end
  -- TODO: there seems to be an issue with >>, futures and the running closure.
  -- this crashes the program.
  p >> fun (m : MyObject) => m.id
end

active class Main
  def main(): unit
    for i <- extract(generateObjects(10000)) do
      print("{}, ", i.id)
    end
  end
end

It is most likely something that we are not tracing correctly, given that we use a big number of futures in the ParT.

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

1 participant