{"action":"created","issue":{"url":"https://api.github.com/repos/jxcore/jxcore/issues/244","labels_url":"https://api.github.com/repos/jxcore/jxcore/issues/244/labels{/name}","comments_url":"https://api.github.com/repos/jxcore/jxcore/issues/244/comments","events_url":"https://api.github.com/repos/jxcore/jxcore/issues/244/events","html_url":"https://github.com/jxcore/jxcore/pull/244","id":62653166,"number":244,"title":"Bug Fix - Issue 240 -Deadlock when expiring items out of the memory store","user":{"login":"xtelinco","id":4678277,"avatar_url":"https://avatars.githubusercontent.com/u/4678277?v=3","gravatar_id":"","url":"https://api.github.com/users/xtelinco","html_url":"https://github.com/xtelinco","followers_url":"https://api.github.com/users/xtelinco/followers","following_url":"https://api.github.com/users/xtelinco/following{/other_user}","gists_url":"https://api.github.com/users/xtelinco/gists{/gist_id}","starred_url":"https://api.github.com/users/xtelinco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xtelinco/subscriptions","organizations_url":"https://api.github.com/users/xtelinco/orgs","repos_url":"https://api.github.com/users/xtelinco/repos","events_url":"https://api.github.com/users/xtelinco/events{/privacy}","received_events_url":"https://api.github.com/users/xtelinco/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-18T10:26:35Z","updated_at":"2015-03-21T21:55:41Z","closed_at":"2015-03-18T18:32:28Z","pull_request":{"url":"https://api.github.com/repos/jxcore/jxcore/pulls/244","html_url":"https://github.com/jxcore/jxcore/pull/244","diff_url":"https://github.com/jxcore/jxcore/pull/244.diff","patch_url":"https://github.com/jxcore/jxcore/pull/244.patch"},"body":"When expiring items out of the memory store, the locks are taken in the wrong order.\r\nThe modifier functions in src/wrappers/memory_wrap.cc take the locks in the reverse\r\norder to this function, hence causes a race condition which can end in two threads\r\nholding and waiting for a lock that the other holds.\r\n\r\nModified this function so that the timers lock is taken first, collects a list\r\nof keys to delete, releases the timer lock and takes the store lock. The\r\nresult being that a dead lock is impossible.\r\n\r\nTested on a machine running jx core under high load. Dead lock has now not occurred for\r\n72 hours. Previously dead locks occurred every 6 hours."},"comment":{"url":"https://api.github.com/repos/jxcore/jxcore/issues/comments/84458477","html_url":"https://github.com/jxcore/jxcore/pull/244#issuecomment-84458477","issue_url":"https://api.github.com/repos/jxcore/jxcore/issues/244","id":84458477,"user":{"login":"xtelinco","id":4678277,"avatar_url":"https://avatars.githubusercontent.com/u/4678277?v=3","gravatar_id":"","url":"https://api.github.com/users/xtelinco","html_url":"https://github.com/xtelinco","followers_url":"https://api.github.com/users/xtelinco/followers","following_url":"https://api.github.com/users/xtelinco/following{/other_user}","gists_url":"https://api.github.com/users/xtelinco/gists{/gist_id}","starred_url":"https://api.github.com/users/xtelinco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xtelinco/subscriptions","organizations_url":"https://api.github.com/users/xtelinco/orgs","repos_url":"https://api.github.com/users/xtelinco/repos","events_url":"https://api.github.com/users/xtelinco/events{/privacy}","received_events_url":"https://api.github.com/users/xtelinco/received_events","type":"User","site_admin":false},"created_at":"2015-03-21T21:55:41Z","updated_at":"2015-03-21T21:55:41Z","body":"I think I found out why that loop was coded to only erases one item at a time. btree_map doesn't work the same way as std::map, hence erasing multiple items in a loop has to be done differently. I think I have worked it out now, and the new code is in test. I will create a pull request in a couple of days if all is well.\r\n\r\nI also have a fix for some javascript code. The function in question is safeBlock which I have stopped using in my development, as I can't get it to work as I feel correctly. Maybe it is working fine for you, but do you want to see my thoughts on that one as well? It doesn't work in the way I think it should."}}