Skip to content

Sequencing a big number of futures crashes the ParT #1

@kikofernandez

Description

@kikofernandez

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions