{"action":"created","comment":{"url":"https://api.github.com/repos/corda/corda/pulls/comments/129562131","pull_request_review_id":52345813,"id":129562131,"diff_hunk":"@@ -0,0 +1,208 @@\n+package net.corda.testing\n+\n+import co.paralleluniverse.fibers.Fiber\n+import co.paralleluniverse.fibers.Instrumented\n+import co.paralleluniverse.fibers.Stack\n+import co.paralleluniverse.fibers.Suspendable\n+import com.fasterxml.jackson.annotation.JsonInclude\n+import com.fasterxml.jackson.databind.ObjectMapper\n+import com.fasterxml.jackson.databind.SerializationFeature\n+import net.corda.core.flows.*\n+import net.corda.core.flows.FlowStackSnapshot.Frame\n+import net.corda.core.internal.FlowStateMachine\n+import net.corda.core.serialization.SerializeAsToken\n+import java.io.File\n+import java.nio.file.Path\n+import java.time.LocalDateTime\n+import java.time.format.DateTimeFormatter\n+import kotlin.reflect.full.isSubclassOf\n+\n+public class FlowStackSnapshotFactoryProvider private constructor() {\n+\n+    private object Holder {\n+        val INSTANCE = FlowStackSnapshotFactoryImpl()\n+    }\n+\n+    companion object {\n+        val instance: FlowStackSnapshotFactory by lazy { Holder.INSTANCE }\n+    }\n+}\n+\n+fun initialiseFlowStackSnapshotFactory() {\n+    FlowStackSnapshotDefaults.FLOW_STACK_SNAPSHOT_FACTORY = FlowStackSnapshotFactoryProvider.instance\n+}\n+\n+private class FlowStackSnapshotFactoryImpl : FlowStackSnapshotFactory {\n+\n+    @Suspendable\n+    override fun getFlowStackSnapshot(flowClass: Class<*>): FlowStackSnapshot {\n+        var snapshot: FlowStackSnapshot? = null\n+        val stackTrace = Fiber.currentFiber().stackTrace\n+        Fiber.parkAndSerialize { fiber, _ ->\n+            snapshot = extractStackSnapshotFromFiber(fiber, stackTrace.toList(), flowClass)\n+            Fiber.unparkDeserialized(fiber, fiber.scheduler)\n+        }\n+        // This is because the dump itself is on the stack, which means it creates a loop in the object graph, we set","path":"test-utils/src/main/kotlin/net/corda/testing/FlowStackSnapshot.kt","position":45,"original_position":45,"commit_id":"eb121746b793b8bf7872c722915dd934e572a12a","original_commit_id":"eb121746b793b8bf7872c722915dd934e572a12a","user":{"login":"mikehearn","id":971089,"avatar_url":"https://avatars2.githubusercontent.com/u/971089?v=4","gravatar_id":"","url":"https://api.github.com/users/mikehearn","html_url":"https://github.com/mikehearn","followers_url":"https://api.github.com/users/mikehearn/followers","following_url":"https://api.github.com/users/mikehearn/following{/other_user}","gists_url":"https://api.github.com/users/mikehearn/gists{/gist_id}","starred_url":"https://api.github.com/users/mikehearn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikehearn/subscriptions","organizations_url":"https://api.github.com/users/mikehearn/orgs","repos_url":"https://api.github.com/users/mikehearn/repos","events_url":"https://api.github.com/users/mikehearn/events{/privacy}","received_events_url":"https://api.github.com/users/mikehearn/received_events","type":"User","site_admin":false},"body":"Hm shouldn't the dumping be able to handle cycles in the object graph? I realise JSON can't do this but then maybe that's a sign to not use JSON ;) For instance this might work better:\r\n\r\nhttps://github.com/EsotericSoftware/yamlbeans\r\n\r\n","created_at":"2017-07-26T12:53:04Z","updated_at":"2017-07-26T12:55:58Z","html_url":"https://github.com/corda/corda/pull/1094#discussion_r129562131","pull_request_url":"https://api.github.com/repos/corda/corda/pulls/1094","_links":{"self":{"href":"https://api.github.com/repos/corda/corda/pulls/comments/129562131"},"html":{"href":"https://github.com/corda/corda/pull/1094#discussion_r129562131"},"pull_request":{"href":"https://api.github.com/repos/corda/corda/pulls/1094"}}},"pull_request":{"url":"https://api.github.com/repos/corda/corda/pulls/1094","id":131798376,"html_url":"https://github.com/corda/corda/pull/1094","diff_url":"https://github.com/corda/corda/pull/1094.diff","patch_url":"https://github.com/corda/corda/pull/1094.patch","issue_url":"https://api.github.com/repos/corda/corda/issues/1094","number":1094,"state":"open","locked":false,"title":"Flow stack snapshot feature","user":{"login":"mkit","id":1511293,"avatar_url":"https://avatars3.githubusercontent.com/u/1511293?v=4","gravatar_id":"","url":"https://api.github.com/users/mkit","html_url":"https://github.com/mkit","followers_url":"https://api.github.com/users/mkit/followers","following_url":"https://api.github.com/users/mkit/following{/other_user}","gists_url":"https://api.github.com/users/mkit/gists{/gist_id}","starred_url":"https://api.github.com/users/mkit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkit/subscriptions","organizations_url":"https://api.github.com/users/mkit/orgs","repos_url":"https://api.github.com/users/mkit/repos","events_url":"https://api.github.com/users/mkit/events{/privacy}","received_events_url":"https://api.github.com/users/mkit/received_events","type":"User","site_admin":false},"body":"The flow debug feature supporting a CordApps developer during the flow debugging process by providing a possibility to access quasar stack at chosen points of the flow execution.\r\nApart from the at runtime inspection possibility, the feature provides also stack persistence into a json file.\r\n\r\nNotes:\r\n1. The output file will omit frames that are internal to the corda platform (e.g. any calls in the FlowStateMachineImpl.kt) and will consist only frames related to the executed flow.\r\nSimilarly, stored frames are stripped of the stack objects that are internal to the corda platform that do not bring any value from the debugging perspective.\r\n\r\n2. Note that, the stack objects are shallow copies.\r\n\r\n3. Due to quasar optimisation feature, some stack traces might not be accompanied with all the local variables that would be normally expected while inspecting the stack. Quasar reduces the amount of data being stored on its stack, by checking (via code analyses during the instrumentation phase) if methods are \"pure\" (in Quasar terms), meaning that their execution can be replayed, then all the local variables are skipped.","created_at":"2017-07-21T15:20:51Z","updated_at":"2017-07-26T12:55:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d63151a0d88e6663f246f939414c9b53ba4f05d2","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/corda/corda/pulls/1094/commits","review_comments_url":"https://api.github.com/repos/corda/corda/pulls/1094/comments","review_comment_url":"https://api.github.com/repos/corda/corda/pulls/comments{/number}","comments_url":"https://api.github.com/repos/corda/corda/issues/1094/comments","statuses_url":"https://api.github.com/repos/corda/corda/statuses/eb121746b793b8bf7872c722915dd934e572a12a","head":{"label":"corda:aslemmer-quasar-stack-dump","ref":"aslemmer-quasar-stack-dump","sha":"eb121746b793b8bf7872c722915dd934e572a12a","user":{"login":"corda","id":22600631,"avatar_url":"https://avatars1.githubusercontent.com/u/22600631?v=4","gravatar_id":"","url":"https://api.github.com/users/corda","html_url":"https://github.com/corda","followers_url":"https://api.github.com/users/corda/followers","following_url":"https://api.github.com/users/corda/following{/other_user}","gists_url":"https://api.github.com/users/corda/gists{/gist_id}","starred_url":"https://api.github.com/users/corda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corda/subscriptions","organizations_url":"https://api.github.com/users/corda/orgs","repos_url":"https://api.github.com/users/corda/repos","events_url":"https://api.github.com/users/corda/events{/privacy}","received_events_url":"https://api.github.com/users/corda/received_events","type":"Organization","site_admin":false},"repo":{"id":70137417,"name":"corda","full_name":"corda/corda","owner":{"login":"corda","id":22600631,"avatar_url":"https://avatars1.githubusercontent.com/u/22600631?v=4","gravatar_id":"","url":"https://api.github.com/users/corda","html_url":"https://github.com/corda","followers_url":"https://api.github.com/users/corda/followers","following_url":"https://api.github.com/users/corda/following{/other_user}","gists_url":"https://api.github.com/users/corda/gists{/gist_id}","starred_url":"https://api.github.com/users/corda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corda/subscriptions","organizations_url":"https://api.github.com/users/corda/orgs","repos_url":"https://api.github.com/users/corda/repos","events_url":"https://api.github.com/users/corda/events{/privacy}","received_events_url":"https://api.github.com/users/corda/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/corda/corda","description":"Corda is a distributed ledger platform designed to record, manage and automate legal agreements between business partners. Designed by (and for) the world's largest financial institutions, it offers a unique response to the privacy and scalability challenges facing decentralised applications.","fork":false,"url":"https://api.github.com/repos/corda/corda","forks_url":"https://api.github.com/repos/corda/corda/forks","keys_url":"https://api.github.com/repos/corda/corda/keys{/key_id}","collaborators_url":"https://api.github.com/repos/corda/corda/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/corda/corda/teams","hooks_url":"https://api.github.com/repos/corda/corda/hooks","issue_events_url":"https://api.github.com/repos/corda/corda/issues/events{/number}","events_url":"https://api.github.com/repos/corda/corda/events","assignees_url":"https://api.github.com/repos/corda/corda/assignees{/user}","branches_url":"https://api.github.com/repos/corda/corda/branches{/branch}","tags_url":"https://api.github.com/repos/corda/corda/tags","blobs_url":"https://api.github.com/repos/corda/corda/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/corda/corda/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/corda/corda/git/refs{/sha}","trees_url":"https://api.github.com/repos/corda/corda/git/trees{/sha}","statuses_url":"https://api.github.com/repos/corda/corda/statuses/{sha}","languages_url":"https://api.github.com/repos/corda/corda/languages","stargazers_url":"https://api.github.com/repos/corda/corda/stargazers","contributors_url":"https://api.github.com/repos/corda/corda/contributors","subscribers_url":"https://api.github.com/repos/corda/corda/subscribers","subscription_url":"https://api.github.com/repos/corda/corda/subscription","commits_url":"https://api.github.com/repos/corda/corda/commits{/sha}","git_commits_url":"https://api.github.com/repos/corda/corda/git/commits{/sha}","comments_url":"https://api.github.com/repos/corda/corda/comments{/number}","issue_comment_url":"https://api.github.com/repos/corda/corda/issues/comments{/number}","contents_url":"https://api.github.com/repos/corda/corda/contents/{+path}","compare_url":"https://api.github.com/repos/corda/corda/compare/{base}...{head}","merges_url":"https://api.github.com/repos/corda/corda/merges","archive_url":"https://api.github.com/repos/corda/corda/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/corda/corda/downloads","issues_url":"https://api.github.com/repos/corda/corda/issues{/number}","pulls_url":"https://api.github.com/repos/corda/corda/pulls{/number}","milestones_url":"https://api.github.com/repos/corda/corda/milestones{/number}","notifications_url":"https://api.github.com/repos/corda/corda/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/corda/corda/labels{/name}","releases_url":"https://api.github.com/repos/corda/corda/releases{/id}","deployments_url":"https://api.github.com/repos/corda/corda/deployments","created_at":"2016-10-06T08:46:29Z","updated_at":"2017-07-26T07:13:31Z","pushed_at":"2017-07-26T12:45:08Z","git_url":"git://github.com/corda/corda.git","ssh_url":"git@github.com:corda/corda.git","clone_url":"https://github.com/corda/corda.git","svn_url":"https://github.com/corda/corda","homepage":"https://www.corda.net","size":91191,"stargazers_count":834,"watchers_count":834,"language":"Kotlin","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":247,"mirror_url":null,"open_issues_count":90,"forks":247,"open_issues":90,"watchers":834,"default_branch":"master"}},"base":{"label":"corda:master","ref":"master","sha":"68d05eee0490fbbe6a116a799b03f558c6b68a08","user":{"login":"corda","id":22600631,"avatar_url":"https://avatars1.githubusercontent.com/u/22600631?v=4","gravatar_id":"","url":"https://api.github.com/users/corda","html_url":"https://github.com/corda","followers_url":"https://api.github.com/users/corda/followers","following_url":"https://api.github.com/users/corda/following{/other_user}","gists_url":"https://api.github.com/users/corda/gists{/gist_id}","starred_url":"https://api.github.com/users/corda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corda/subscriptions","organizations_url":"https://api.github.com/users/corda/orgs","repos_url":"https://api.github.com/users/corda/repos","events_url":"https://api.github.com/users/corda/events{/privacy}","received_events_url":"https://api.github.com/users/corda/received_events","type":"Organization","site_admin":false},"repo":{"id":70137417,"name":"corda","full_name":"corda/corda","owner":{"login":"corda","id":22600631,"avatar_url":"https://avatars1.githubusercontent.com/u/22600631?v=4","gravatar_id":"","url":"https://api.github.com/users/corda","html_url":"https://github.com/corda","followers_url":"https://api.github.com/users/corda/followers","following_url":"https://api.github.com/users/corda/following{/other_user}","gists_url":"https://api.github.com/users/corda/gists{/gist_id}","starred_url":"https://api.github.com/users/corda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corda/subscriptions","organizations_url":"https://api.github.com/users/corda/orgs","repos_url":"https://api.github.com/users/corda/repos","events_url":"https://api.github.com/users/corda/events{/privacy}","received_events_url":"https://api.github.com/users/corda/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/corda/corda","description":"Corda is a distributed ledger platform designed to record, manage and automate legal agreements between business partners. Designed by (and for) the world's largest financial institutions, it offers a unique response to the privacy and scalability challenges facing decentralised applications.","fork":false,"url":"https://api.github.com/repos/corda/corda","forks_url":"https://api.github.com/repos/corda/corda/forks","keys_url":"https://api.github.com/repos/corda/corda/keys{/key_id}","collaborators_url":"https://api.github.com/repos/corda/corda/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/corda/corda/teams","hooks_url":"https://api.github.com/repos/corda/corda/hooks","issue_events_url":"https://api.github.com/repos/corda/corda/issues/events{/number}","events_url":"https://api.github.com/repos/corda/corda/events","assignees_url":"https://api.github.com/repos/corda/corda/assignees{/user}","branches_url":"https://api.github.com/repos/corda/corda/branches{/branch}","tags_url":"https://api.github.com/repos/corda/corda/tags","blobs_url":"https://api.github.com/repos/corda/corda/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/corda/corda/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/corda/corda/git/refs{/sha}","trees_url":"https://api.github.com/repos/corda/corda/git/trees{/sha}","statuses_url":"https://api.github.com/repos/corda/corda/statuses/{sha}","languages_url":"https://api.github.com/repos/corda/corda/languages","stargazers_url":"https://api.github.com/repos/corda/corda/stargazers","contributors_url":"https://api.github.com/repos/corda/corda/contributors","subscribers_url":"https://api.github.com/repos/corda/corda/subscribers","subscription_url":"https://api.github.com/repos/corda/corda/subscription","commits_url":"https://api.github.com/repos/corda/corda/commits{/sha}","git_commits_url":"https://api.github.com/repos/corda/corda/git/commits{/sha}","comments_url":"https://api.github.com/repos/corda/corda/comments{/number}","issue_comment_url":"https://api.github.com/repos/corda/corda/issues/comments{/number}","contents_url":"https://api.github.com/repos/corda/corda/contents/{+path}","compare_url":"https://api.github.com/repos/corda/corda/compare/{base}...{head}","merges_url":"https://api.github.com/repos/corda/corda/merges","archive_url":"https://api.github.com/repos/corda/corda/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/corda/corda/downloads","issues_url":"https://api.github.com/repos/corda/corda/issues{/number}","pulls_url":"https://api.github.com/repos/corda/corda/pulls{/number}","milestones_url":"https://api.github.com/repos/corda/corda/milestones{/number}","notifications_url":"https://api.github.com/repos/corda/corda/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/corda/corda/labels{/name}","releases_url":"https://api.github.com/repos/corda/corda/releases{/id}","deployments_url":"https://api.github.com/repos/corda/corda/deployments","created_at":"2016-10-06T08:46:29Z","updated_at":"2017-07-26T07:13:31Z","pushed_at":"2017-07-26T12:45:08Z","git_url":"git://github.com/corda/corda.git","ssh_url":"git@github.com:corda/corda.git","clone_url":"https://github.com/corda/corda.git","svn_url":"https://github.com/corda/corda","homepage":"https://www.corda.net","size":91191,"stargazers_count":834,"watchers_count":834,"language":"Kotlin","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":247,"mirror_url":null,"open_issues_count":90,"forks":247,"open_issues":90,"watchers":834,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/corda/corda/pulls/1094"},"html":{"href":"https://github.com/corda/corda/pull/1094"},"issue":{"href":"https://api.github.com/repos/corda/corda/issues/1094"},"comments":{"href":"https://api.github.com/repos/corda/corda/issues/1094/comments"},"review_comments":{"href":"https://api.github.com/repos/corda/corda/pulls/1094/comments"},"review_comment":{"href":"https://api.github.com/repos/corda/corda/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/corda/corda/pulls/1094/commits"},"statuses":{"href":"https://api.github.com/repos/corda/corda/statuses/eb121746b793b8bf7872c722915dd934e572a12a"}}}}
{"actor":{"display_login":"mikehearn"}}