{"action":"opened","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/27990","repository_url":"https://api.github.com/repos/dart-lang/sdk","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/27990/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/27990/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/27990/events","html_url":"https://github.com/dart-lang/sdk/issues/27990","id":193500599,"number":27990,"title":"VM doesn't send isolate exit event when last isolate action is to throw.","user":{"login":"lrhn","id":4865287,"avatar_url":"https://avatars.githubusercontent.com/u/4865287?v=3","gravatar_id":"","url":"https://api.github.com/users/lrhn","html_url":"https://github.com/lrhn","followers_url":"https://api.github.com/users/lrhn/followers","following_url":"https://api.github.com/users/lrhn/following{/other_user}","gists_url":"https://api.github.com/users/lrhn/gists{/gist_id}","starred_url":"https://api.github.com/users/lrhn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lrhn/subscriptions","organizations_url":"https://api.github.com/users/lrhn/orgs","repos_url":"https://api.github.com/users/lrhn/repos","events_url":"https://api.github.com/users/lrhn/events{/privacy}","received_events_url":"https://api.github.com/users/lrhn/received_events","type":"User","site_admin":false},"labels":[{"id":219928165,"url":"https://api.github.com/repos/dart-lang/sdk/labels/area-vm","name":"area-vm","color":"c7def8","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-05T13:48:19Z","updated_at":"2016-12-05T13:48:19Z","closed_at":null,"body":"Example:\r\n```dart\r\nimport \"dart:async\" show Timer;\r\nimport \"dart:isolate\" show Isolate, RawReceivePort;\r\n\r\nmain() {\r\n  Isolate.spawn(spawnMain, null,\r\n                paused: true, errorsAreFatal: false).then((i) {\r\n    var port = new RawReceivePort();\r\n    port.handler = (msg) {\r\n      if (msg is List) {\r\n        print(\"Error: ${msg[0]}\");\r\n      } else {\r\n        print(\"isolate terminated: $msg\");\r\n        port.close();\r\n      }\r\n    };\r\n    i.addOnExitListener(port.sendPort, response: \"right answer!\");\r\n    i.addErrorListener(port.sendPort);\r\n\r\n    i.resume(i.pauseCapability);\r\n  });\r\n}\r\n\r\nspawnMain(_) {\r\n  for (int i = 0; i < 5; i++) {\r\n    Timer.run(() {\r\n      throw \"Error $i\";\r\n    });\r\n  }\r\n  // Timer.run(() {});\r\n}\r\n```\r\nRunning this code on the VM prints five errors and then hangs. If I remove the comment before the last `Timer.run` call, it correctly prints five errors and then prints `isolate terminated: ...` and exits.\r\n\r\nThat means that the \"isolate exit\" message isn't sent. It seems to only happen when the last action of the isolate was to throw.\r\n\r\nIt's not clear whether it's because the spawned isolate doesn't actually exit, or because it forgets to send the message, in either case it's wrong."}}
{"actor":{"display_login":"lrhn"}}