{"action":"created","comment":{"url":"https://api.github.com/repos/scala/scala/pulls/comments/178807726","pull_request_review_id":108927432,"id":178807726,"diff_hunk":"@@ -422,7 +423,7 @@ class Global(var currentSettings: Settings, reporter0: Reporter)\n         currentRun.currentUnit = unit0\n       }\n     }\n-\n+    SourceReader","path":"src/compiler/scala/tools/nsc/Global.scala","position":13,"original_position":13,"commit_id":"0a9c00d78bb3e20a69dd17b0559faf1e19a99b84","original_commit_id":"0a9c00d78bb3e20a69dd17b0559faf1e19a99b84","user":{"login":"adriaanm","id":91083,"avatar_url":"https://avatars2.githubusercontent.com/u/91083?v=4","gravatar_id":"","url":"https://api.github.com/users/adriaanm","html_url":"https://github.com/adriaanm","followers_url":"https://api.github.com/users/adriaanm/followers","following_url":"https://api.github.com/users/adriaanm/following{/other_user}","gists_url":"https://api.github.com/users/adriaanm/gists{/gist_id}","starred_url":"https://api.github.com/users/adriaanm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriaanm/subscriptions","organizations_url":"https://api.github.com/users/adriaanm/orgs","repos_url":"https://api.github.com/users/adriaanm/repos","events_url":"https://api.github.com/users/adriaanm/events{/privacy}","received_events_url":"https://api.github.com/users/adriaanm/received_events","type":"User","site_admin":false},"body":"stray?","created_at":"2018-04-03T12:35:19Z","updated_at":"2018-04-03T12:37:42Z","html_url":"https://github.com/scala/scala/pull/6479#discussion_r178807726","pull_request_url":"https://api.github.com/repos/scala/scala/pulls/6479","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/scala/scala/pulls/comments/178807726"},"html":{"href":"https://github.com/scala/scala/pull/6479#discussion_r178807726"},"pull_request":{"href":"https://api.github.com/repos/scala/scala/pulls/6479"}}},"pull_request":{"url":"https://api.github.com/repos/scala/scala/pulls/6479","id":178235710,"html_url":"https://github.com/scala/scala/pull/6479","diff_url":"https://github.com/scala/scala/pull/6479.diff","patch_url":"https://github.com/scala/scala/pull/6479.patch","issue_url":"https://api.github.com/repos/scala/scala/issues/6479","number":6479,"state":"open","locked":false,"title":"Support cancellation of batch compilation","user":{"login":"retronym","id":65551,"avatar_url":"https://avatars0.githubusercontent.com/u/65551?v=4","gravatar_id":"","url":"https://api.github.com/users/retronym","html_url":"https://github.com/retronym","followers_url":"https://api.github.com/users/retronym/followers","following_url":"https://api.github.com/users/retronym/following{/other_user}","gists_url":"https://api.github.com/users/retronym/gists{/gist_id}","starred_url":"https://api.github.com/users/retronym/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retronym/subscriptions","organizations_url":"https://api.github.com/users/retronym/orgs","repos_url":"https://api.github.com/users/retronym/repos","events_url":"https://api.github.com/users/retronym/events{/privacy}","received_events_url":"https://api.github.com/users/retronym/received_events","type":"User","site_admin":false},"body":"A common means of cancelling a task is to shutdown the thread pool\r\nexecuting it. That's what SBT's CTRL-C handler does, for example.\r\nTypically, thread pools call `Thread.interrupt()` to cooperatively stop the\r\nworkload. We need to do our part by checking `interrupted()` from time to\r\ntime, and translating this into an exception that will stop compilation.\r\n\r\nSide note: SBT's CTRL-C handler is not on by default, you need to add\r\nthe following to `build.sbt`.\r\n\r\n```scala\r\ncancellable in Global := true\r\n```\r\n\r\nWe actually were doing this in some places, by accident, by virtue\r\nof calling NIO file reading/writing APIs, which throw a specific exception\r\nif the thread is interrupted. The first commits here harden the places\r\nwhere we were preventing these exceptions from bubbling up and stopping the\r\ncompiler. Before this change, an interrupt during the parser or bcode phase\r\nended up issuing an stack trace and/or an error for each source/class file.\r\n\r\nThe final commit adds additional checks for the interrupt status. Perhaps the\r\ncheck within `Typer.typed` is contentious, it aims to make cancellation\r\nresponsive even in large source files. We'll see if there is a performance\r\ndifference here, and perhaps move it to `typedDefDef` where it will fire\r\nwith an appropriate frequency.\r\n\r\nTested by using these commits as STARR for our SBT build and hitting\r\nCTRL-C at different moments during `library/compile`.\r\n\r\n## baseline behaviour\r\n\r\n### Cancel during parser:\r\n```\r\n[error] IO error while decoding /Users/jz/code/scala/src/library/scala/Tuple5.scala with UTF-8\r\n[error] Please try specifying another one using the -encoding option\r\n[error] IO error while decoding /Users/jz/code/scala/src/library/scala/Tuple6.scala with UTF-8\r\n[error] Please try specifying another one using the -encoding option\r\n[error] IO error while decoding /Users/jz/code/scala/src/library/scala/Tuple7.scala with UTF-8\r\n[error] Please try specifying another one using the -encoding option\r\n[error] 704 errors found\r\n```\r\n\r\n### Cancel after parser\r\n\r\n```\r\n> library/compile\r\n[info] Compiling 584 Scala sources and 120 Java sources to /Users/jz/code/scala/build/quick/classes/library...\r\n^C\r\n[warn] Canceling execution...\r\n\r\n<BIG PAUSE/>\r\n\r\njava.nio.channels.ClosedByInterruptException\r\n    at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:202)\r\n    at sun.nio.ch.FileChannelImpl.writeInternal(FileChannelImpl.java:783)\r\n    at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:764)\r\n    at scala.tools.nsc.backend.jvm.ClassfileWriters$ClassfileWriter$DirClassWriter.write(ClassfileWriters.scala:179)\r\n    at scala.tools.nsc.backend.jvm.PostProcessor.sendToDisk(PostProcessor.scala:76)\r\n...\r\njava.nio.channels.ClosedByInterruptException\r\n    at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:202)\r\n    at sun.nio.ch.FileChannelImpl.writeInternal(FileChannelImpl.java:783)\r\n    at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:764)\r\n    at scala.tools.nsc.backend.jvm.ClassfileWriters$ClassfileWriter$DirClassWriter.write(ClassfileWriters.scala:179)\r\n    at scala.tools.nsc.backend.jvm.PostProcessor.sendToDisk(PostProcessor.scala:76)\r\n...\r\njava.nio.channels.ClosedByInterruptException\r\n    at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:202)\r\n    at sun.nio.ch.FileChannelImpl.writeInternal(FileChannelImpl.java:783)\r\n    at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:764)\r\n    at scala.tools.nsc.backend.jvm.ClassfileWriters$ClassfileWriter$DirClassWriter.write(ClassfileWriters.scala:179)\r\n    at scala.tools.nsc.backend.jvm.PostProcessor.sendToDisk(PostProcessor.scala:76)\r\n...\r\n\r\n[error] 584 errors found\r\n\r\n```\r\n\r\n## New behaviour\r\n\r\n### Cancel any time\r\n\r\n```\r\n[info] Compiling 584 Scala sources and 120 Java sources to /Users/jz/code/scala/build/quick/classes/library...\r\n^C\r\n[warn] Canceling execution...\r\njava.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ExecutorCompletionService$QueueingFuture@35798cd0 rejected from java.util.concurrent.ThreadPoolExecutor@2fc70622[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 194]\r\n\tat java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)\r\n```","created_at":"2018-03-29T06:15:05Z","updated_at":"2018-04-03T12:37:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b1389ad8607c1240f59c84939176bdb936e98edb","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":{"url":"https://api.github.com/repos/scala/scala/milestones/72","html_url":"https://github.com/scala/scala/milestone/72","labels_url":"https://api.github.com/repos/scala/scala/milestones/72/labels","id":3133017,"number":72,"title":"2.12.6","description":"Lead: @adriaanm. Release date moved up to fix a [Java 9/10 regression](https://github.com/scala/scala-dev/issues/480) regarding macros. For feature development, please target 2.13.x. 2.12 is now restricted to bug fixes.","creator":{"login":"lrytz","id":119636,"avatar_url":"https://avatars1.githubusercontent.com/u/119636?v=4","gravatar_id":"","url":"https://api.github.com/users/lrytz","html_url":"https://github.com/lrytz","followers_url":"https://api.github.com/users/lrytz/followers","following_url":"https://api.github.com/users/lrytz/following{/other_user}","gists_url":"https://api.github.com/users/lrytz/gists{/gist_id}","starred_url":"https://api.github.com/users/lrytz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lrytz/subscriptions","organizations_url":"https://api.github.com/users/lrytz/orgs","repos_url":"https://api.github.com/users/lrytz/repos","events_url":"https://api.github.com/users/lrytz/events{/privacy}","received_events_url":"https://api.github.com/users/lrytz/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":16,"state":"open","created_at":"2018-02-21T13:51:57Z","updated_at":"2018-04-03T11:52:16Z","due_on":"2018-04-09T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/scala/scala/pulls/6479/commits","review_comments_url":"https://api.github.com/repos/scala/scala/pulls/6479/comments","review_comment_url":"https://api.github.com/repos/scala/scala/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scala/scala/issues/6479/comments","statuses_url":"https://api.github.com/repos/scala/scala/statuses/0a9c00d78bb3e20a69dd17b0559faf1e19a99b84","head":{"label":"retronym:topic/compiler-interrupted","ref":"topic/compiler-interrupted","sha":"0a9c00d78bb3e20a69dd17b0559faf1e19a99b84","user":{"login":"retronym","id":65551,"avatar_url":"https://avatars0.githubusercontent.com/u/65551?v=4","gravatar_id":"","url":"https://api.github.com/users/retronym","html_url":"https://github.com/retronym","followers_url":"https://api.github.com/users/retronym/followers","following_url":"https://api.github.com/users/retronym/following{/other_user}","gists_url":"https://api.github.com/users/retronym/gists{/gist_id}","starred_url":"https://api.github.com/users/retronym/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retronym/subscriptions","organizations_url":"https://api.github.com/users/retronym/orgs","repos_url":"https://api.github.com/users/retronym/repos","events_url":"https://api.github.com/users/retronym/events{/privacy}","received_events_url":"https://api.github.com/users/retronym/received_events","type":"User","site_admin":false},"repo":{"id":2902104,"name":"scala","full_name":"retronym/scala","owner":{"login":"retronym","id":65551,"avatar_url":"https://avatars0.githubusercontent.com/u/65551?v=4","gravatar_id":"","url":"https://api.github.com/users/retronym","html_url":"https://github.com/retronym","followers_url":"https://api.github.com/users/retronym/followers","following_url":"https://api.github.com/users/retronym/following{/other_user}","gists_url":"https://api.github.com/users/retronym/gists{/gist_id}","starred_url":"https://api.github.com/users/retronym/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retronym/subscriptions","organizations_url":"https://api.github.com/users/retronym/orgs","repos_url":"https://api.github.com/users/retronym/repos","events_url":"https://api.github.com/users/retronym/events{/privacy}","received_events_url":"https://api.github.com/users/retronym/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/retronym/scala","description":"The Scala programming language","fork":true,"url":"https://api.github.com/repos/retronym/scala","forks_url":"https://api.github.com/repos/retronym/scala/forks","keys_url":"https://api.github.com/repos/retronym/scala/keys{/key_id}","collaborators_url":"https://api.github.com/repos/retronym/scala/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/retronym/scala/teams","hooks_url":"https://api.github.com/repos/retronym/scala/hooks","issue_events_url":"https://api.github.com/repos/retronym/scala/issues/events{/number}","events_url":"https://api.github.com/repos/retronym/scala/events","assignees_url":"https://api.github.com/repos/retronym/scala/assignees{/user}","branches_url":"https://api.github.com/repos/retronym/scala/branches{/branch}","tags_url":"https://api.github.com/repos/retronym/scala/tags","blobs_url":"https://api.github.com/repos/retronym/scala/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/retronym/scala/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/retronym/scala/git/refs{/sha}","trees_url":"https://api.github.com/repos/retronym/scala/git/trees{/sha}","statuses_url":"https://api.github.com/repos/retronym/scala/statuses/{sha}","languages_url":"https://api.github.com/repos/retronym/scala/languages","stargazers_url":"https://api.github.com/repos/retronym/scala/stargazers","contributors_url":"https://api.github.com/repos/retronym/scala/contributors","subscribers_url":"https://api.github.com/repos/retronym/scala/subscribers","subscription_url":"https://api.github.com/repos/retronym/scala/subscription","commits_url":"https://api.github.com/repos/retronym/scala/commits{/sha}","git_commits_url":"https://api.github.com/repos/retronym/scala/git/commits{/sha}","comments_url":"https://api.github.com/repos/retronym/scala/comments{/number}","issue_comment_url":"https://api.github.com/repos/retronym/scala/issues/comments{/number}","contents_url":"https://api.github.com/repos/retronym/scala/contents/{+path}","compare_url":"https://api.github.com/repos/retronym/scala/compare/{base}...{head}","merges_url":"https://api.github.com/repos/retronym/scala/merges","archive_url":"https://api.github.com/repos/retronym/scala/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/retronym/scala/downloads","issues_url":"https://api.github.com/repos/retronym/scala/issues{/number}","pulls_url":"https://api.github.com/repos/retronym/scala/pulls{/number}","milestones_url":"https://api.github.com/repos/retronym/scala/milestones{/number}","notifications_url":"https://api.github.com/repos/retronym/scala/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/retronym/scala/labels{/name}","releases_url":"https://api.github.com/repos/retronym/scala/releases{/id}","deployments_url":"https://api.github.com/repos/retronym/scala/deployments","created_at":"2011-12-02T23:04:11Z","updated_at":"2015-05-09T21:40:12Z","pushed_at":"2018-04-03T04:01:45Z","git_url":"git://github.com/retronym/scala.git","ssh_url":"git@github.com:retronym/scala.git","clone_url":"https://github.com/retronym/scala.git","svn_url":"https://github.com/retronym/scala","homepage":"http://www.scala-lang.org/","size":135205,"stargazers_count":5,"watchers_count":5,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":5,"default_branch":"master"}},"base":{"label":"scala:2.12.x","ref":"2.12.x","sha":"8120af87ca0dcffbe5d6ebaf11bb0245e75733c2","user":{"login":"scala","id":57059,"avatar_url":"https://avatars2.githubusercontent.com/u/57059?v=4","gravatar_id":"","url":"https://api.github.com/users/scala","html_url":"https://github.com/scala","followers_url":"https://api.github.com/users/scala/followers","following_url":"https://api.github.com/users/scala/following{/other_user}","gists_url":"https://api.github.com/users/scala/gists{/gist_id}","starred_url":"https://api.github.com/users/scala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala/subscriptions","organizations_url":"https://api.github.com/users/scala/orgs","repos_url":"https://api.github.com/users/scala/repos","events_url":"https://api.github.com/users/scala/events{/privacy}","received_events_url":"https://api.github.com/users/scala/received_events","type":"Organization","site_admin":false},"repo":{"id":2888818,"name":"scala","full_name":"scala/scala","owner":{"login":"scala","id":57059,"avatar_url":"https://avatars2.githubusercontent.com/u/57059?v=4","gravatar_id":"","url":"https://api.github.com/users/scala","html_url":"https://github.com/scala","followers_url":"https://api.github.com/users/scala/followers","following_url":"https://api.github.com/users/scala/following{/other_user}","gists_url":"https://api.github.com/users/scala/gists{/gist_id}","starred_url":"https://api.github.com/users/scala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala/subscriptions","organizations_url":"https://api.github.com/users/scala/orgs","repos_url":"https://api.github.com/users/scala/repos","events_url":"https://api.github.com/users/scala/events{/privacy}","received_events_url":"https://api.github.com/users/scala/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scala/scala","description":"The Scala programming language","fork":false,"url":"https://api.github.com/repos/scala/scala","forks_url":"https://api.github.com/repos/scala/scala/forks","keys_url":"https://api.github.com/repos/scala/scala/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scala/scala/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scala/scala/teams","hooks_url":"https://api.github.com/repos/scala/scala/hooks","issue_events_url":"https://api.github.com/repos/scala/scala/issues/events{/number}","events_url":"https://api.github.com/repos/scala/scala/events","assignees_url":"https://api.github.com/repos/scala/scala/assignees{/user}","branches_url":"https://api.github.com/repos/scala/scala/branches{/branch}","tags_url":"https://api.github.com/repos/scala/scala/tags","blobs_url":"https://api.github.com/repos/scala/scala/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scala/scala/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scala/scala/git/refs{/sha}","trees_url":"https://api.github.com/repos/scala/scala/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scala/scala/statuses/{sha}","languages_url":"https://api.github.com/repos/scala/scala/languages","stargazers_url":"https://api.github.com/repos/scala/scala/stargazers","contributors_url":"https://api.github.com/repos/scala/scala/contributors","subscribers_url":"https://api.github.com/repos/scala/scala/subscribers","subscription_url":"https://api.github.com/repos/scala/scala/subscription","commits_url":"https://api.github.com/repos/scala/scala/commits{/sha}","git_commits_url":"https://api.github.com/repos/scala/scala/git/commits{/sha}","comments_url":"https://api.github.com/repos/scala/scala/comments{/number}","issue_comment_url":"https://api.github.com/repos/scala/scala/issues/comments{/number}","contents_url":"https://api.github.com/repos/scala/scala/contents/{+path}","compare_url":"https://api.github.com/repos/scala/scala/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scala/scala/merges","archive_url":"https://api.github.com/repos/scala/scala/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scala/scala/downloads","issues_url":"https://api.github.com/repos/scala/scala/issues{/number}","pulls_url":"https://api.github.com/repos/scala/scala/pulls{/number}","milestones_url":"https://api.github.com/repos/scala/scala/milestones{/number}","notifications_url":"https://api.github.com/repos/scala/scala/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scala/scala/labels{/name}","releases_url":"https://api.github.com/repos/scala/scala/releases{/id}","deployments_url":"https://api.github.com/repos/scala/scala/deployments","created_at":"2011-12-01T05:02:34Z","updated_at":"2018-04-03T12:31:49Z","pushed_at":"2018-04-03T12:30:48Z","git_url":"git://github.com/scala/scala.git","ssh_url":"git@github.com:scala/scala.git","clone_url":"https://github.com/scala/scala.git","svn_url":"https://github.com/scala/scala","homepage":"http://www.scala-lang.org/","size":94646,"stargazers_count":9980,"watchers_count":9980,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":2376,"mirror_url":null,"archived":false,"open_issues_count":124,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":2376,"open_issues":124,"watchers":9980,"default_branch":"2.13.x"}},"_links":{"self":{"href":"https://api.github.com/repos/scala/scala/pulls/6479"},"html":{"href":"https://github.com/scala/scala/pull/6479"},"issue":{"href":"https://api.github.com/repos/scala/scala/issues/6479"},"comments":{"href":"https://api.github.com/repos/scala/scala/issues/6479/comments"},"review_comments":{"href":"https://api.github.com/repos/scala/scala/pulls/6479/comments"},"review_comment":{"href":"https://api.github.com/repos/scala/scala/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scala/scala/pulls/6479/commits"},"statuses":{"href":"https://api.github.com/repos/scala/scala/statuses/0a9c00d78bb3e20a69dd17b0559faf1e19a99b84"}},"author_association":"OWNER"}}
{"actor":{"display_login":"adriaanm"}}