{"action":"created","issue":{"url":"https://api.github.com/repos/ponylang/ponyc/issues/2686","repository_url":"https://api.github.com/repos/ponylang/ponyc","labels_url":"https://api.github.com/repos/ponylang/ponyc/issues/2686/labels{/name}","comments_url":"https://api.github.com/repos/ponylang/ponyc/issues/2686/comments","events_url":"https://api.github.com/repos/ponylang/ponyc/issues/2686/events","html_url":"https://github.com/ponylang/ponyc/issues/2686","id":320002054,"number":2686,"title":"segfault of generated code","user":{"login":"crzbear","id":27771572,"avatar_url":"https://avatars1.githubusercontent.com/u/27771572?v=4","gravatar_id":"","url":"https://api.github.com/users/crzbear","html_url":"https://github.com/crzbear","followers_url":"https://api.github.com/users/crzbear/followers","following_url":"https://api.github.com/users/crzbear/following{/other_user}","gists_url":"https://api.github.com/users/crzbear/gists{/gist_id}","starred_url":"https://api.github.com/users/crzbear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crzbear/subscriptions","organizations_url":"https://api.github.com/users/crzbear/orgs","repos_url":"https://api.github.com/users/crzbear/repos","events_url":"https://api.github.com/users/crzbear/events{/privacy}","received_events_url":"https://api.github.com/users/crzbear/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-03T16:57:50Z","updated_at":"2018-05-12T16:56:23Z","closed_at":null,"author_association":"NONE","body":"hi,\r\n\r\nhere's another somewhat more obscure crash\r\n\r\nchanging the lambda capability to iso doesnt crash,\r\npassing env.out instead of main to NotifyActor, doesnt crash with either capability\r\n\r\ncrashing here after tick 17 with 1 timer and after tick 8 of 2 timers\r\n(maybe until a specific number of gc runs have taken place?)\r\nso the lambda doesnt even need to be called\r\nin fact if it is called for all timers before a crash could happen\r\neverything looks fine and the program exits normally\r\n\r\nagain thanks for looking into it\r\n\r\n```\r\nuse \"package:time\"\r\n\r\nactor Main\r\n    let _out: OutStream\r\n    let _timers: Timers\r\n\r\n    new create(env: Env) =>\r\n        _out = env.out\r\n\r\n        _timers = Timers.create(20)\r\n        _timers.apply(Timer.create(TimerRelay.create(NotifyActor.create(this), _timers), Nanos.from_seconds(1), Nanos.from_seconds(1)))\r\n        _timers.apply(Timer.create(TimerRelay.create(NotifyActor.create(this), _timers), Nanos.from_seconds(1), Nanos.from_seconds(1)))\r\n\r\n    be print(text: String) =>\r\n        _out.print(text)\r\n\r\nclass TimerRelay is TimerNotify\r\n    let _notify: NotifyActor tag\r\n    let _timers: Timers tag\r\n\r\n    new iso create(notify: NotifyActor tag, timers: Timers tag) =>\r\n        _notify = notify\r\n        _timers = timers\r\n\r\n    fun ref apply(timer: Timer ref, count: U64 val): Bool val =>\r\n        let t: Timer tag = timer\r\n        _notify.tick(\r\n            count,\r\n            {   \r\n                ()(_timers, t) =>\r\n                    _timers.cancel(t)\r\n            } val\r\n        )\r\n        true\r\n\r\nactor NotifyActor\r\n    let _main: Main\r\n\r\n    var _counter: U64 = 0\r\n\r\n    new create(main: Main) =>\r\n        _main = main\r\n\r\n    be tick(count: U64 val, cancel: {()} val) =>\r\n        _counter = _counter + count\r\n        _main.print(\"counter \" + _counter.string())\r\n        if _counter >= 32 then\r\n            cancel()\r\n        end\r\n```"},"comment":{"url":"https://api.github.com/repos/ponylang/ponyc/issues/comments/388568420","html_url":"https://github.com/ponylang/ponyc/issues/2686#issuecomment-388568420","issue_url":"https://api.github.com/repos/ponylang/ponyc/issues/2686","id":388568420,"user":{"login":"crzbear","id":27771572,"avatar_url":"https://avatars1.githubusercontent.com/u/27771572?v=4","gravatar_id":"","url":"https://api.github.com/users/crzbear","html_url":"https://github.com/crzbear","followers_url":"https://api.github.com/users/crzbear/followers","following_url":"https://api.github.com/users/crzbear/following{/other_user}","gists_url":"https://api.github.com/users/crzbear/gists{/gist_id}","starred_url":"https://api.github.com/users/crzbear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crzbear/subscriptions","organizations_url":"https://api.github.com/users/crzbear/orgs","repos_url":"https://api.github.com/users/crzbear/repos","events_url":"https://api.github.com/users/crzbear/events{/privacy}","received_events_url":"https://api.github.com/users/crzbear/received_events","type":"User","site_admin":false},"created_at":"2018-05-12T16:56:23Z","updated_at":"2018-05-12T16:56:23Z","author_association":"NONE","body":"will do once i'm back home\r\nso it isn't crashing for you (anyone else)?"}}
{"actor":{"display_login":"crzbear"}}