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

Futures (and other runtime structures) get corrupted during runtime #48

Closed
EliasC opened this issue Jan 22, 2015 · 4 comments
Closed

Futures (and other runtime structures) get corrupted during runtime #48

EliasC opened this issue Jan 22, 2015 · 4 comments

Comments

@EliasC
Copy link
Contributor

EliasC commented Jan 22, 2015

See #47 for an example of this bug in action. During debugging, I have seen the address being used for a future reused for a stream link (struct scons) before they were used, leading me to suspect the garbage collector. Maybe adding tracing functionality to futures and stream links (and any other runtime structures) is enough (although we also need a proper root set).

@albertnetymk
Copy link
Contributor

The below code snippet contains cyclic dependency on purpose. The mem allocated for the stream would be reclaimed when start is finished. Hopefully, it provides some insight.

#!/usr/bin/env encorec -run

-- a Sequence of Integers
class IntSeq

  stream start(a: Main, fr : int, to : int) : int {
    print "intseq";
    while fr <= to {
      yield fr;
      fr = fr+1
    };
    get a.dummy()
  }

class Main
  def dummy() : void
    print "Over"

  def main() : void
    let
      lst = 0
      str = (new IntSeq).start(this, 1,100000)
    in {
      while not eos str {
        lst = get str;
        str = getNext str;
        print lst;
      };
      print lst -- never reach here due to cyclic dep
    }

@TobiasWrigstad
Copy link
Contributor

Can you be more specific? What other structures?

What happens if you replace pony_alloc with malloc for the structures?

@EliasC
Copy link
Contributor Author

EliasC commented Jan 23, 2015

I've seen it for sure with the structures for streams (i.e. struct scons), and there the problem goes away if malloc is used everywhere.

@EliasC
Copy link
Contributor Author

EliasC commented May 21, 2015

I think this is no longer a problem (similar reasoning as #91, plus largestream.enc is now passing). Closing.

@EliasC EliasC closed this as completed May 21, 2015
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

3 participants