{"action":"created","issue":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/7015","labels_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/7015/labels{/name}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/7015/comments","events_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/7015/events","html_url":"https://github.com/bitcoin/bitcoin/issues/7015","id":116885273,"number":7015,"title":"getblocktemplate blocks submitblock","user":{"login":"jtoomim","id":11898859,"avatar_url":"https://avatars.githubusercontent.com/u/11898859?v=3","gravatar_id":"","url":"https://api.github.com/users/jtoomim","html_url":"https://github.com/jtoomim","followers_url":"https://api.github.com/users/jtoomim/followers","following_url":"https://api.github.com/users/jtoomim/following{/other_user}","gists_url":"https://api.github.com/users/jtoomim/gists{/gist_id}","starred_url":"https://api.github.com/users/jtoomim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtoomim/subscriptions","organizations_url":"https://api.github.com/users/jtoomim/orgs","repos_url":"https://api.github.com/users/jtoomim/repos","events_url":"https://api.github.com/users/jtoomim/events{/privacy}","received_events_url":"https://api.github.com/users/jtoomim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-14T01:26:43Z","updated_at":"2015-11-14T01:56:59Z","closed_at":null,"body":"I ran into this during testing on BIP101. My mempool was pretty full, so GBT was slow. During one 12-second GBT call, ckpool found a block:\r\n\r\n```\r\n[2015-11-14 00:26:16.931] Possible block solve diff 541623.733740 !\r\n[2015-11-14 00:26:26.164] HTTP socket read+write took 10.954s in json_rpc_call ( \"getblock...)\r\n[2015-11-14 00:26:29.144] BLOCK ACCEPTED!\r\n[2015-11-14 00:26:29.157] Solved and confirmed block 604647\r\n```\r\n\r\nNote the timestamp. That's 12.2 seconds of delay between ckpool making the block solve and bitcoind accepting the block. I can see the other 1.3 seconds as possibly being block verification time or dealing with the other network messages that piled on during the 10.9 seconds that GBT took. IIRC, this was a 5 MB block.\r\n\r\nThis problem was seen on BitcoinXT, not Bitcoin Core, but it affects you too, so I thought I should notify upstream (Core). The underlying issue is how locks are done in CreateNewBlock and elsewhere. Locking cs_main in everything, including both submitblock (rpcmining.cpp:639) and getblocktemplate, is problematic.\r\n\r\nA workaround for this is to set up multiple bitcoinds, and set the poolserver to do submitblock to all of them in parallel. Kinda nasty, though. Another workaround is to speed up CNB a la @morcos's work. The locks should still get fixed, though."},"comment":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/comments/156607420","html_url":"https://github.com/bitcoin/bitcoin/issues/7015#issuecomment-156607420","issue_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/7015","id":156607420,"user":{"login":"gmaxwell","id":858454,"avatar_url":"https://avatars.githubusercontent.com/u/858454?v=3","gravatar_id":"","url":"https://api.github.com/users/gmaxwell","html_url":"https://github.com/gmaxwell","followers_url":"https://api.github.com/users/gmaxwell/followers","following_url":"https://api.github.com/users/gmaxwell/following{/other_user}","gists_url":"https://api.github.com/users/gmaxwell/gists{/gist_id}","starred_url":"https://api.github.com/users/gmaxwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmaxwell/subscriptions","organizations_url":"https://api.github.com/users/gmaxwell/orgs","repos_url":"https://api.github.com/users/gmaxwell/repos","events_url":"https://api.github.com/users/gmaxwell/events{/privacy}","received_events_url":"https://api.github.com/users/gmaxwell/received_events","type":"User","site_admin":false},"created_at":"2015-11-14T01:56:59Z","updated_at":"2015-11-14T01:56:59Z","body":"This is more complex than you think."}}