{"action":"created","comment":{"url":"https://api.github.com/repos/MSRCCS/Prajna/pulls/comments/42275514","id":42275514,"diff_hunk":"@@ -1171,10 +1171,146 @@ type internal ThreadPoolWait internal (id:int) as this =\n         member x.Dispose() = \n             CleanUp.Current.CleanUpAll()\n             GC.SuppressFinalize(x)\n-            \n-\n-            \n-\n+          \n+/// ThreadPoolWait.RegisterWaitForSingleObject, with capability:\n+/// 1. To remove a particular wait handle. \n+/// 2. To show all wait handles queued in the system, \n+/// and 3. To show long continuation (not normal). \n+type internal ThreadPoolWait() = \n+    static let rwhToRemove = ConcurrentQueue<_>()\n+    static let rwhLookup = ConcurrentDictionary<_,_>()\n+    /// Maximum wait for the RegisteredWaitHandle to show up\n+    static member val private MaxSpinMs = 0 with get, set\n+    static member val WarningWaitInMs = 10 with get, set\n+    static member val ActiveThreadPools = ConcurrentDictionary<_,_>() with get\n+    static member val WaitHandleCollection = ConcurrentDictionary<_,ConcurrentDictionary<_,_>>() with get\n+    static member RegisterThreadPool (name:string) = \n+        Logger.LogF( LogLevel.MediumVerbose, ( fun _ -> sprintf \"ThreadPoolWait, register wait pool %s ............\" name ))\n+        ThreadPoolWait.ActiveThreadPools.Item( name ) <- DateTime.UtcNow\n+    static member UnregisterThreadPool (name:string) = \n+        Logger.LogF( LogLevel.MildVerbose, ( fun _ -> sprintf \"ThreadPoolWait, unregister wait pool %s ............\" name ))\n+        ThreadPoolWait.ActiveThreadPools.TryRemove( name ) |> ignore\n+        if ThreadPoolWait.ActiveThreadPools.IsEmpty then \n+            if ( !(ThreadPoolWaitDeprecated.NumberOfWaitingThreads) > 0 ) then ","path":"src/tools/tools/process.fs","position":272,"original_position":272,"commit_id":"691b9d1c0d7052177af50ee02cc50ab4318f95f8","original_commit_id":"691b9d1c0d7052177af50ee02cc50ab4318f95f8","user":{"login":"zhuweirong","id":13244178,"avatar_url":"https://avatars.githubusercontent.com/u/13244178?v=3","gravatar_id":"","url":"https://api.github.com/users/zhuweirong","html_url":"https://github.com/zhuweirong","followers_url":"https://api.github.com/users/zhuweirong/followers","following_url":"https://api.github.com/users/zhuweirong/following{/other_user}","gists_url":"https://api.github.com/users/zhuweirong/gists{/gist_id}","starred_url":"https://api.github.com/users/zhuweirong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhuweirong/subscriptions","organizations_url":"https://api.github.com/users/zhuweirong/orgs","repos_url":"https://api.github.com/users/zhuweirong/repos","events_url":"https://api.github.com/users/zhuweirong/events{/privacy}","received_events_url":"https://api.github.com/users/zhuweirong/received_events","type":"User","site_admin":false},"body":"Why check ThreadPoolWaitDeprecated?","created_at":"2015-10-16T18:38:11Z","updated_at":"2015-10-16T18:38:11Z","html_url":"https://github.com/MSRCCS/Prajna/pull/76#discussion_r42275514","pull_request_url":"https://api.github.com/repos/MSRCCS/Prajna/pulls/76","_links":{"self":{"href":"https://api.github.com/repos/MSRCCS/Prajna/pulls/comments/42275514"},"html":{"href":"https://github.com/MSRCCS/Prajna/pull/76#discussion_r42275514"},"pull_request":{"href":"https://api.github.com/repos/MSRCCS/Prajna/pulls/76"}}},"pull_request":{"url":"https://api.github.com/repos/MSRCCS/Prajna/pulls/76","id":47867918,"html_url":"https://github.com/MSRCCS/Prajna/pull/76","diff_url":"https://github.com/MSRCCS/Prajna/pull/76.diff","patch_url":"https://github.com/MSRCCS/Prajna/pull/76.patch","issue_url":"https://api.github.com/repos/MSRCCS/Prajna/issues/76","number":76,"state":"open","locked":false,"title":"Alternative implementation of ThreadPoolWait.","user":{"login":"jinlmsft","id":7265672,"avatar_url":"https://avatars.githubusercontent.com/u/7265672?v=3","gravatar_id":"","url":"https://api.github.com/users/jinlmsft","html_url":"https://github.com/jinlmsft","followers_url":"https://api.github.com/users/jinlmsft/followers","following_url":"https://api.github.com/users/jinlmsft/following{/other_user}","gists_url":"https://api.github.com/users/jinlmsft/gists{/gist_id}","starred_url":"https://api.github.com/users/jinlmsft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jinlmsft/subscriptions","organizations_url":"https://api.github.com/users/jinlmsft/orgs","repos_url":"https://api.github.com/users/jinlmsft/repos","events_url":"https://api.github.com/users/jinlmsft/events{/privacy}","received_events_url":"https://api.github.com/users/jinlmsft/received_events","type":"User","site_admin":false},"body":"ThreadPoolWait implement functionality of ThreadPoolWait .RegisterWaitForSingleObject, with three capability:\r\n\r\n1. To remove a particular wait handle and cancel its operation\r\n2. To show all wait handles queued in the system,\r\nand 3. To show long continuation (not normal).\r\n\r\nThe old implementation uses a customized threadpool. The new implementation uses ThreadPoolWait.RegisterWaitForSingleObject.\r\n\r\nOne potential performance issue is that:\r\n\r\nThreadPoolWait.MaxSpinMs = 200 ms.\r\n\r\nThis is the time between the callback is called, and the registeredWaitHandle is put into the system. I found that if I set\r\n\r\nThreadPoolWait.MaxSpinMs = 50 ms.\r\n\r\nSometime, the system will show it is unable to grab the registeredWaitHandle in 50ms. I can't reason why it takes so long for the\r\nThreadPoolWait.RegisterWaitForSingleObject to get back. In slower system, we may need to use a even larger wait.","created_at":"2015-10-16T03:37:47Z","updated_at":"2015-10-16T18:38:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8e746f8592fe577ae524d69f6f5a1e8227f43888","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MSRCCS/Prajna/pulls/76/commits","review_comments_url":"https://api.github.com/repos/MSRCCS/Prajna/pulls/76/comments","review_comment_url":"https://api.github.com/repos/MSRCCS/Prajna/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MSRCCS/Prajna/issues/76/comments","statuses_url":"https://api.github.com/repos/MSRCCS/Prajna/statuses/691b9d1c0d7052177af50ee02cc50ab4318f95f8","head":{"label":"jinlmsft:master","ref":"master","sha":"691b9d1c0d7052177af50ee02cc50ab4318f95f8","user":{"login":"jinlmsft","id":7265672,"avatar_url":"https://avatars.githubusercontent.com/u/7265672?v=3","gravatar_id":"","url":"https://api.github.com/users/jinlmsft","html_url":"https://github.com/jinlmsft","followers_url":"https://api.github.com/users/jinlmsft/followers","following_url":"https://api.github.com/users/jinlmsft/following{/other_user}","gists_url":"https://api.github.com/users/jinlmsft/gists{/gist_id}","starred_url":"https://api.github.com/users/jinlmsft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jinlmsft/subscriptions","organizations_url":"https://api.github.com/users/jinlmsft/orgs","repos_url":"https://api.github.com/users/jinlmsft/repos","events_url":"https://api.github.com/users/jinlmsft/events{/privacy}","received_events_url":"https://api.github.com/users/jinlmsft/received_events","type":"User","site_admin":false},"repo":{"id":40675660,"name":"Prajna","full_name":"jinlmsft/Prajna","owner":{"login":"jinlmsft","id":7265672,"avatar_url":"https://avatars.githubusercontent.com/u/7265672?v=3","gravatar_id":"","url":"https://api.github.com/users/jinlmsft","html_url":"https://github.com/jinlmsft","followers_url":"https://api.github.com/users/jinlmsft/followers","following_url":"https://api.github.com/users/jinlmsft/following{/other_user}","gists_url":"https://api.github.com/users/jinlmsft/gists{/gist_id}","starred_url":"https://api.github.com/users/jinlmsft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jinlmsft/subscriptions","organizations_url":"https://api.github.com/users/jinlmsft/orgs","repos_url":"https://api.github.com/users/jinlmsft/repos","events_url":"https://api.github.com/users/jinlmsft/events{/privacy}","received_events_url":"https://api.github.com/users/jinlmsft/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jinlmsft/Prajna","description":"Prajna: A Distributed Functional Programming Platform for Interactive Big Data Analytics and Cloud Service Building","fork":true,"url":"https://api.github.com/repos/jinlmsft/Prajna","forks_url":"https://api.github.com/repos/jinlmsft/Prajna/forks","keys_url":"https://api.github.com/repos/jinlmsft/Prajna/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jinlmsft/Prajna/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jinlmsft/Prajna/teams","hooks_url":"https://api.github.com/repos/jinlmsft/Prajna/hooks","issue_events_url":"https://api.github.com/repos/jinlmsft/Prajna/issues/events{/number}","events_url":"https://api.github.com/repos/jinlmsft/Prajna/events","assignees_url":"https://api.github.com/repos/jinlmsft/Prajna/assignees{/user}","branches_url":"https://api.github.com/repos/jinlmsft/Prajna/branches{/branch}","tags_url":"https://api.github.com/repos/jinlmsft/Prajna/tags","blobs_url":"https://api.github.com/repos/jinlmsft/Prajna/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jinlmsft/Prajna/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jinlmsft/Prajna/git/refs{/sha}","trees_url":"https://api.github.com/repos/jinlmsft/Prajna/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jinlmsft/Prajna/statuses/{sha}","languages_url":"https://api.github.com/repos/jinlmsft/Prajna/languages","stargazers_url":"https://api.github.com/repos/jinlmsft/Prajna/stargazers","contributors_url":"https://api.github.com/repos/jinlmsft/Prajna/contributors","subscribers_url":"https://api.github.com/repos/jinlmsft/Prajna/subscribers","subscription_url":"https://api.github.com/repos/jinlmsft/Prajna/subscription","commits_url":"https://api.github.com/repos/jinlmsft/Prajna/commits{/sha}","git_commits_url":"https://api.github.com/repos/jinlmsft/Prajna/git/commits{/sha}","comments_url":"https://api.github.com/repos/jinlmsft/Prajna/comments{/number}","issue_comment_url":"https://api.github.com/repos/jinlmsft/Prajna/issues/comments{/number}","contents_url":"https://api.github.com/repos/jinlmsft/Prajna/contents/{+path}","compare_url":"https://api.github.com/repos/jinlmsft/Prajna/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jinlmsft/Prajna/merges","archive_url":"https://api.github.com/repos/jinlmsft/Prajna/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jinlmsft/Prajna/downloads","issues_url":"https://api.github.com/repos/jinlmsft/Prajna/issues{/number}","pulls_url":"https://api.github.com/repos/jinlmsft/Prajna/pulls{/number}","milestones_url":"https://api.github.com/repos/jinlmsft/Prajna/milestones{/number}","notifications_url":"https://api.github.com/repos/jinlmsft/Prajna/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jinlmsft/Prajna/labels{/name}","releases_url":"https://api.github.com/repos/jinlmsft/Prajna/releases{/id}","created_at":"2015-08-13T18:40:00Z","updated_at":"2015-08-13T18:40:01Z","pushed_at":"2015-10-16T18:29:01Z","git_url":"git://github.com/jinlmsft/Prajna.git","ssh_url":"git@github.com:jinlmsft/Prajna.git","clone_url":"https://github.com/jinlmsft/Prajna.git","svn_url":"https://github.com/jinlmsft/Prajna","homepage":"http://MSRCCS.github.io/Prajna","size":5225,"stargazers_count":0,"watchers_count":0,"language":"F#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"MSRCCS:master","ref":"master","sha":"bd604391cdaf3578ed961076a0b4c33bec398510","user":{"login":"MSRCCS","id":13593104,"avatar_url":"https://avatars.githubusercontent.com/u/13593104?v=3","gravatar_id":"","url":"https://api.github.com/users/MSRCCS","html_url":"https://github.com/MSRCCS","followers_url":"https://api.github.com/users/MSRCCS/followers","following_url":"https://api.github.com/users/MSRCCS/following{/other_user}","gists_url":"https://api.github.com/users/MSRCCS/gists{/gist_id}","starred_url":"https://api.github.com/users/MSRCCS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSRCCS/subscriptions","organizations_url":"https://api.github.com/users/MSRCCS/orgs","repos_url":"https://api.github.com/users/MSRCCS/repos","events_url":"https://api.github.com/users/MSRCCS/events{/privacy}","received_events_url":"https://api.github.com/users/MSRCCS/received_events","type":"Organization","site_admin":false},"repo":{"id":40625359,"name":"Prajna","full_name":"MSRCCS/Prajna","owner":{"login":"MSRCCS","id":13593104,"avatar_url":"https://avatars.githubusercontent.com/u/13593104?v=3","gravatar_id":"","url":"https://api.github.com/users/MSRCCS","html_url":"https://github.com/MSRCCS","followers_url":"https://api.github.com/users/MSRCCS/followers","following_url":"https://api.github.com/users/MSRCCS/following{/other_user}","gists_url":"https://api.github.com/users/MSRCCS/gists{/gist_id}","starred_url":"https://api.github.com/users/MSRCCS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSRCCS/subscriptions","organizations_url":"https://api.github.com/users/MSRCCS/orgs","repos_url":"https://api.github.com/users/MSRCCS/repos","events_url":"https://api.github.com/users/MSRCCS/events{/privacy}","received_events_url":"https://api.github.com/users/MSRCCS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MSRCCS/Prajna","description":"Prajna: A Distributed Functional Programming Platform for Interactive Big Data Analytics and Cloud Service Building","fork":false,"url":"https://api.github.com/repos/MSRCCS/Prajna","forks_url":"https://api.github.com/repos/MSRCCS/Prajna/forks","keys_url":"https://api.github.com/repos/MSRCCS/Prajna/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MSRCCS/Prajna/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MSRCCS/Prajna/teams","hooks_url":"https://api.github.com/repos/MSRCCS/Prajna/hooks","issue_events_url":"https://api.github.com/repos/MSRCCS/Prajna/issues/events{/number}","events_url":"https://api.github.com/repos/MSRCCS/Prajna/events","assignees_url":"https://api.github.com/repos/MSRCCS/Prajna/assignees{/user}","branches_url":"https://api.github.com/repos/MSRCCS/Prajna/branches{/branch}","tags_url":"https://api.github.com/repos/MSRCCS/Prajna/tags","blobs_url":"https://api.github.com/repos/MSRCCS/Prajna/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MSRCCS/Prajna/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MSRCCS/Prajna/git/refs{/sha}","trees_url":"https://api.github.com/repos/MSRCCS/Prajna/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MSRCCS/Prajna/statuses/{sha}","languages_url":"https://api.github.com/repos/MSRCCS/Prajna/languages","stargazers_url":"https://api.github.com/repos/MSRCCS/Prajna/stargazers","contributors_url":"https://api.github.com/repos/MSRCCS/Prajna/contributors","subscribers_url":"https://api.github.com/repos/MSRCCS/Prajna/subscribers","subscription_url":"https://api.github.com/repos/MSRCCS/Prajna/subscription","commits_url":"https://api.github.com/repos/MSRCCS/Prajna/commits{/sha}","git_commits_url":"https://api.github.com/repos/MSRCCS/Prajna/git/commits{/sha}","comments_url":"https://api.github.com/repos/MSRCCS/Prajna/comments{/number}","issue_comment_url":"https://api.github.com/repos/MSRCCS/Prajna/issues/comments{/number}","contents_url":"https://api.github.com/repos/MSRCCS/Prajna/contents/{+path}","compare_url":"https://api.github.com/repos/MSRCCS/Prajna/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MSRCCS/Prajna/merges","archive_url":"https://api.github.com/repos/MSRCCS/Prajna/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MSRCCS/Prajna/downloads","issues_url":"https://api.github.com/repos/MSRCCS/Prajna/issues{/number}","pulls_url":"https://api.github.com/repos/MSRCCS/Prajna/pulls{/number}","milestones_url":"https://api.github.com/repos/MSRCCS/Prajna/milestones{/number}","notifications_url":"https://api.github.com/repos/MSRCCS/Prajna/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MSRCCS/Prajna/labels{/name}","releases_url":"https://api.github.com/repos/MSRCCS/Prajna/releases{/id}","created_at":"2015-08-12T21:32:16Z","updated_at":"2015-10-15T06:54:51Z","pushed_at":"2015-10-16T18:29:02Z","git_url":"git://github.com/MSRCCS/Prajna.git","ssh_url":"git@github.com:MSRCCS/Prajna.git","clone_url":"https://github.com/MSRCCS/Prajna.git","svn_url":"https://github.com/MSRCCS/Prajna","homepage":"http://MSRCCS.github.io/Prajna","size":6283,"stargazers_count":68,"watchers_count":68,"language":"F#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":18,"mirror_url":null,"open_issues_count":5,"forks":18,"open_issues":5,"watchers":68,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MSRCCS/Prajna/pulls/76"},"html":{"href":"https://github.com/MSRCCS/Prajna/pull/76"},"issue":{"href":"https://api.github.com/repos/MSRCCS/Prajna/issues/76"},"comments":{"href":"https://api.github.com/repos/MSRCCS/Prajna/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/MSRCCS/Prajna/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/MSRCCS/Prajna/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MSRCCS/Prajna/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/MSRCCS/Prajna/statuses/691b9d1c0d7052177af50ee02cc50ab4318f95f8"}}}}