{"action":"created","issue":{"url":"https://api.github.com/repos/google/guava/issues/2799","repository_url":"https://api.github.com/repos/google/guava","labels_url":"https://api.github.com/repos/google/guava/issues/2799/labels{/name}","comments_url":"https://api.github.com/repos/google/guava/issues/2799/comments","events_url":"https://api.github.com/repos/google/guava/issues/2799/events","html_url":"https://github.com/google/guava/pull/2799","id":224114028,"node_id":"MDExOlB1bGxSZXF1ZXN0MTE3NDY3Mjcy","number":2799,"title":"Fix deadlock if compute function throw a RuntimeException","user":{"login":"imario42","id":4653435,"node_id":"MDQ6VXNlcjQ2NTM0MzU=","avatar_url":"https://avatars3.githubusercontent.com/u/4653435?v=4","gravatar_id":"","url":"https://api.github.com/users/imario42","html_url":"https://github.com/imario42","followers_url":"https://api.github.com/users/imario42/followers","following_url":"https://api.github.com/users/imario42/following{/other_user}","gists_url":"https://api.github.com/users/imario42/gists{/gist_id}","starred_url":"https://api.github.com/users/imario42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imario42/subscriptions","organizations_url":"https://api.github.com/users/imario42/orgs","repos_url":"https://api.github.com/users/imario42/repos","events_url":"https://api.github.com/users/imario42/events{/privacy}","received_events_url":"https://api.github.com/users/imario42/received_events","type":"User","site_admin":false},"labels":[{"id":147571624,"node_id":"MDU6TGFiZWwxNDc1NzE2MjQ=","url":"https://api.github.com/repos/google/guava/labels/cla:%20yes","name":"cla: yes","color":"009800","default":false},{"id":143506482,"node_id":"MDU6TGFiZWwxNDM1MDY0ODI=","url":"https://api.github.com/repos/google/guava/labels/package=cache","name":"package=cache","color":"62a0e5","default":false}],"state":"open","locked":false,"assignee":{"login":"lowasser","id":544569,"node_id":"MDQ6VXNlcjU0NDU2OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/544569?v=4","gravatar_id":"","url":"https://api.github.com/users/lowasser","html_url":"https://github.com/lowasser","followers_url":"https://api.github.com/users/lowasser/followers","following_url":"https://api.github.com/users/lowasser/following{/other_user}","gists_url":"https://api.github.com/users/lowasser/gists{/gist_id}","starred_url":"https://api.github.com/users/lowasser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lowasser/subscriptions","organizations_url":"https://api.github.com/users/lowasser/orgs","repos_url":"https://api.github.com/users/lowasser/repos","events_url":"https://api.github.com/users/lowasser/events{/privacy}","received_events_url":"https://api.github.com/users/lowasser/received_events","type":"User","site_admin":false},"assignees":[{"login":"lowasser","id":544569,"node_id":"MDQ6VXNlcjU0NDU2OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/544569?v=4","gravatar_id":"","url":"https://api.github.com/users/lowasser","html_url":"https://github.com/lowasser","followers_url":"https://api.github.com/users/lowasser/followers","following_url":"https://api.github.com/users/lowasser/following{/other_user}","gists_url":"https://api.github.com/users/lowasser/gists{/gist_id}","starred_url":"https://api.github.com/users/lowasser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lowasser/subscriptions","organizations_url":"https://api.github.com/users/lowasser/orgs","repos_url":"https://api.github.com/users/lowasser/repos","events_url":"https://api.github.com/users/lowasser/events{/privacy}","received_events_url":"https://api.github.com/users/lowasser/received_events","type":"User","site_admin":false}],"milestone":null,"comments":9,"created_at":"2017-04-25T12:02:05Z","updated_at":"2018-07-16T08:41:45Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/google/guava/pulls/2799","html_url":"https://github.com/google/guava/pull/2799","diff_url":"https://github.com/google/guava/pull/2799.diff","patch_url":"https://github.com/google/guava/pull/2799.patch"},"body":"If the computeIfAbsent methods fails with a runtime exception, successive calls to computeIfAbsent lock due to a call to oldValue.waitForValue which never will receive a value then.\r\n\r\nA test case to reproduce this behavior - the second computeIfAbsent will never return and your app is frozen.\r\nThe pull request restores the previous state of the cache on RuntimeException and the test will finish correctly.\r\n\r\n`public class TestGuava extends TestCase\r\n{\r\n    private Cache<String, Boolean> cache = CacheBuilder.newBuilder()\r\n            .maximumSize(10000)\r\n            .expireAfterAccess(30, TimeUnit.SECONDS)\r\n            .build();\r\n    private Map<String, Boolean> cacheMap = cache.asMap();\r\n\r\n    private final static Boolean TEST_BOOLEAN = new Boolean(true);\r\n    public void testComputeException()\r\n    {\r\n        try\r\n        {\r\n            cacheMap.computeIfAbsent(\"a\", key ->\r\n            {\r\n                throw new IllegalArgumentException();\r\n            });\r\n\r\n            fail();\r\n        }\r\n        catch (Exception e)\r\n        {\r\n            // expected\r\n        }\r\n\r\n        Boolean ret = cacheMap.computeIfAbsent(\"a\", key -> {\r\n            return TEST_BOOLEAN;\r\n        });\r\n\r\n        assertEquals(Boolean.TRUE, ret);\r\n        assertSame(TEST_BOOLEAN, ret);\r\n\r\n        ret = cacheMap.computeIfAbsent(\"a\", key -> {\r\n            return new Boolean(true); // should not create a new entry\r\n        });\r\n\r\n        assertEquals(Boolean.TRUE, ret);\r\n        assertSame(TEST_BOOLEAN, ret);\r\n    }\r\n}`"},"comment":{"url":"https://api.github.com/repos/google/guava/issues/comments/405181385","html_url":"https://github.com/google/guava/pull/2799#issuecomment-405181385","issue_url":"https://api.github.com/repos/google/guava/issues/2799","id":405181385,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTE4MTM4NQ==","user":{"login":"dawid-stosur","id":23479624,"node_id":"MDQ6VXNlcjIzNDc5NjI0","avatar_url":"https://avatars3.githubusercontent.com/u/23479624?v=4","gravatar_id":"","url":"https://api.github.com/users/dawid-stosur","html_url":"https://github.com/dawid-stosur","followers_url":"https://api.github.com/users/dawid-stosur/followers","following_url":"https://api.github.com/users/dawid-stosur/following{/other_user}","gists_url":"https://api.github.com/users/dawid-stosur/gists{/gist_id}","starred_url":"https://api.github.com/users/dawid-stosur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dawid-stosur/subscriptions","organizations_url":"https://api.github.com/users/dawid-stosur/orgs","repos_url":"https://api.github.com/users/dawid-stosur/repos","events_url":"https://api.github.com/users/dawid-stosur/events{/privacy}","received_events_url":"https://api.github.com/users/dawid-stosur/received_events","type":"User","site_admin":false},"created_at":"2018-07-16T08:41:45Z","updated_at":"2018-07-16T08:41:45Z","author_association":"NONE","body":"We also experienced this issue on PROD so also would like to see it merged ASAP as we use caches extensively throughout the whole project."}}
{"actor":{"display_login":"dawid-stosur"}}