{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2711","repository_url":"https://api.github.com/repos/ethereum/go-ethereum","labels_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2711/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2711/comments","events_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2711/events","html_url":"https://github.com/ethereum/go-ethereum/pull/2711","id":160841996,"number":2711,"title":"Fix #2710 Filter race: concurrent map read and map write","user":{"login":"hdiedrich","id":246863,"avatar_url":"https://avatars.githubusercontent.com/u/246863?v=3","gravatar_id":"","url":"https://api.github.com/users/hdiedrich","html_url":"https://github.com/hdiedrich","followers_url":"https://api.github.com/users/hdiedrich/followers","following_url":"https://api.github.com/users/hdiedrich/following{/other_user}","gists_url":"https://api.github.com/users/hdiedrich/gists{/gist_id}","starred_url":"https://api.github.com/users/hdiedrich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hdiedrich/subscriptions","organizations_url":"https://api.github.com/users/hdiedrich/orgs","repos_url":"https://api.github.com/users/hdiedrich/repos","events_url":"https://api.github.com/users/hdiedrich/events{/privacy}","received_events_url":"https://api.github.com/users/hdiedrich/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-17T08:57:00Z","updated_at":"2016-06-17T08:57:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2711","html_url":"https://github.com/ethereum/go-ethereum/pull/2711","diff_url":"https://github.com/ethereum/go-ethereum/pull/2711.diff","patch_url":"https://github.com/ethereum/go-ethereum/pull/2711.patch"},"body":"Filter problems mostly revealed themselves successively after fixing each preceding one. This patch addresses all of them as each fix leads to crashes into the next bug.\r\n\r\nThis patch started from and addresses the issue #2710 **Filter race: concurrent map read and map write**\r\n\r\nOur tests add and delete filters in fast succession, on weak hardware, which looks like a realistic use case in the light of the lack of relative block range parameters for filters.\r\n\r\nI am trying to make our tests available. The existing test suits catch none of them.\r\n\r\n1. UninstallFilter() missed logMu, blockMu and transactionMu locks before the filter id existence checks in respective queues.\r\n\r\n2. GetFilterLogs() is missing a filterMapMu read lock. GetFilterChanges() could use read locks instead of write locks given it's a RWMutex.\r\n\r\n3. NewBlockFilter() leaves blockMu lock hanging on failing filterManager.Add(). This should virtually never happen except for out of memory in exactly that place but there is a return handling it.\r\n\r\n4. Filters are deadlocking through the call backs called by filterLoop() deadlocking FilterUninstall(), NewBlockFilter() etc:  \r\n\r\n    * the former, filterLoop(), first acquires sf.filterMu, then the callbacks try for s.logMu, blockMu or transactionMu. \r\n    * The latter first acquire s.logMu, blockMu or transactionMu and then by calling filterManager.Add() or Remove() try for sf.filterMu. The solution of this patch is not the prettiest but least invasive.\r\n\r\n5. wrong lock set, logMu instead if transactionMu, in transactionFilterChanged().\r\n\r\n6. transactMu (sic) is not used.\r\n\r\nAdding comments for implicit deadlock risk seemed appropriate to help future refactoring."},"comment":{"url":"https://api.github.com/repos/ethereum/go-ethereum/issues/comments/226717073","html_url":"https://github.com/ethereum/go-ethereum/pull/2711#issuecomment-226717073","issue_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2711","id":226717073,"user":{"login":"robotally","id":13557850,"avatar_url":"https://avatars.githubusercontent.com/u/13557850?v=3","gravatar_id":"","url":"https://api.github.com/users/robotally","html_url":"https://github.com/robotally","followers_url":"https://api.github.com/users/robotally/followers","following_url":"https://api.github.com/users/robotally/following{/other_user}","gists_url":"https://api.github.com/users/robotally/gists{/gist_id}","starred_url":"https://api.github.com/users/robotally/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robotally/subscriptions","organizations_url":"https://api.github.com/users/robotally/orgs","repos_url":"https://api.github.com/users/robotally/repos","events_url":"https://api.github.com/users/robotally/events{/privacy}","received_events_url":"https://api.github.com/users/robotally/received_events","type":"User","site_admin":false},"created_at":"2016-06-17T08:57:01Z","updated_at":"2016-06-17T08:57:01Z","body":"| Vote | Count | Reviewers |\n| :---: | :---: | :---: |\n| :+1: | 0 |  |\n| :-1: | 0 |  |\n\n_Updated: Fri Jun 17 08:57:01 UTC 2016_"}}
{"actor":{"display_login":"robotally"}}