{"action":"created","issue":{"url":"https://api.github.com/repos/dashpay/dash/issues/491","labels_url":"https://api.github.com/repos/dashpay/dash/issues/491/labels{/name}","comments_url":"https://api.github.com/repos/dashpay/dash/issues/491/comments","events_url":"https://api.github.com/repos/dashpay/dash/issues/491/events","html_url":"https://github.com/dashpay/dash/pull/491","id":99790786,"number":491,"title":"(WIP) V0.12.0.x Locks fixes","user":{"login":"UdjinM6","id":1935069,"avatar_url":"https://avatars.githubusercontent.com/u/1935069?v=3","gravatar_id":"","url":"https://api.github.com/users/UdjinM6","html_url":"https://github.com/UdjinM6","followers_url":"https://api.github.com/users/UdjinM6/followers","following_url":"https://api.github.com/users/UdjinM6/following{/other_user}","gists_url":"https://api.github.com/users/UdjinM6/gists{/gist_id}","starred_url":"https://api.github.com/users/UdjinM6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UdjinM6/subscriptions","organizations_url":"https://api.github.com/users/UdjinM6/orgs","repos_url":"https://api.github.com/users/UdjinM6/repos","events_url":"https://api.github.com/users/UdjinM6/events{/privacy}","received_events_url":"https://api.github.com/users/UdjinM6/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dashpay/dash/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/dashpay/dash/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/dashpay/dash/milestones/2","html_url":"https://github.com/dashpay/dash/milestones/12.0","labels_url":"https://api.github.com/repos/dashpay/dash/milestones/2/labels","id":1241295,"number":2,"title":"12.0","description":null,"creator":{"login":"UdjinM6","id":1935069,"avatar_url":"https://avatars.githubusercontent.com/u/1935069?v=3","gravatar_id":"","url":"https://api.github.com/users/UdjinM6","html_url":"https://github.com/UdjinM6","followers_url":"https://api.github.com/users/UdjinM6/followers","following_url":"https://api.github.com/users/UdjinM6/following{/other_user}","gists_url":"https://api.github.com/users/UdjinM6/gists{/gist_id}","starred_url":"https://api.github.com/users/UdjinM6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UdjinM6/subscriptions","organizations_url":"https://api.github.com/users/UdjinM6/orgs","repos_url":"https://api.github.com/users/UdjinM6/repos","events_url":"https://api.github.com/users/UdjinM6/events{/privacy}","received_events_url":"https://api.github.com/users/UdjinM6/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":9,"state":"open","created_at":"2015-08-05T01:16:23Z","updated_at":"2015-08-08T18:11:37Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-08-08T10:32:20Z","updated_at":"2015-08-08T19:05:00Z","closed_at":"2015-08-08T18:11:37Z","pull_request":{"url":"https://api.github.com/repos/dashpay/dash/pulls/491","html_url":"https://github.com/dashpay/dash/pull/491","diff_url":"https://github.com/dashpay/dash/pull/491.diff","patch_url":"https://github.com/dashpay/dash/pull/491.patch"},"body":"Another attempt to fix locking issue. Same ideas as #489 but will actually lock right when it can instead of standalone checks so applied directly only in specific places.\r\n\r\n- trylock for `updateDarksendProgress`, `checkBalanceChanged`, \"block\"\r\n- trylock+wait for `UnlockCoins`, `SendDarksendDenominate`, `ProcessNewBlock`, `ActivateBestChain`\r\n- move `cs_darksend ` trylock in `DoAutomaticDenominating` lower, remove explicit lock\r\n\r\nLooks good so far...\r\nI think patching in few most common \"hung\" places with\r\n```\r\n    while(true) {\r\n        TRY_LOCK(cs_main, lockMain);\r\n        if(!lockMain) { MilliSleep(10); continue; }\r\n        ...\r\n        break;\r\n    }\r\n```\r\nis a quite safe way to go.\r\n\r\nTesting anyone? :)"},"comment":{"url":"https://api.github.com/repos/dashpay/dash/issues/comments/129036042","html_url":"https://github.com/dashpay/dash/pull/491#issuecomment-129036042","issue_url":"https://api.github.com/repos/dashpay/dash/issues/491","id":129036042,"user":{"login":"evan82","id":3793664,"avatar_url":"https://avatars.githubusercontent.com/u/3793664?v=3","gravatar_id":"","url":"https://api.github.com/users/evan82","html_url":"https://github.com/evan82","followers_url":"https://api.github.com/users/evan82/followers","following_url":"https://api.github.com/users/evan82/following{/other_user}","gists_url":"https://api.github.com/users/evan82/gists{/gist_id}","starred_url":"https://api.github.com/users/evan82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evan82/subscriptions","organizations_url":"https://api.github.com/users/evan82/orgs","repos_url":"https://api.github.com/users/evan82/repos","events_url":"https://api.github.com/users/evan82/events{/privacy}","received_events_url":"https://api.github.com/users/evan82/received_events","type":"User","site_admin":false},"created_at":"2015-08-08T19:05:00Z","updated_at":"2015-08-08T19:05:00Z","body":"I just had a hang, here's the last debug logs:\r\n\r\n2015-08-08 19:01:34 POTENTIAL DEADLOCK DETECTED\r\n2015-08-08 19:01:34 Previous lock order was:\r\n2015-08-08 19:01:34  (1) pwalletMain->cs_wallet  activemasternode.cpp:347\r\n2015-08-08 19:01:34  (2) cs_main  wallet.cpp:1494\r\n2015-08-08 19:01:34 Current lock order is:\r\n2015-08-08 19:01:34  (2) cs_main  main.cpp:2620\r\n2015-08-08 19:01:34  (2) cs_main  wallet.cpp:773\r\n2015-08-08 19:01:34  (1) cs_wallet  wallet.cpp:773\r\n\r\n\r\n2015-08-08 19:01:34 LOCKCONTENTION: cs_main\r\n2015-08-08 19:01:34 Locker: wallet.cpp:1494\r\n2015-08-08 19:01:34 LOCKCONTENTION: cs_wallet\r\n2015-08-08 19:01:34 Locker: wallet.cpp:2983\r\n2015-08-08 19:01:46 LOCKCONTENTION: cs_main\r\n2015-08-08 19:01:46 Locker: rpcserver.cpp:1020\r\n2015-08-08 19:01:57 LOCKCONTENTION: cs_main\r\n2015-08-08 19:01:57 Locker: main.cpp:305\r\n2015-08-08 19:02:15 LOCKCONTENTION: cs_main\r\n2015-08-08 19:02:15 Locker: rpcserver.cpp:1020\r\n2015-08-08 19:02:56 LOCKCONTENTION: cs_main\r\n2015-08-08 19:02:56 Locker: rpcserver.cpp:1020\r\n"}}