{"action":"created","issue":{"url":"https://api.github.com/repos/Jasig/cas/issues/1333","repository_url":"https://api.github.com/repos/Jasig/cas","labels_url":"https://api.github.com/repos/Jasig/cas/issues/1333/labels{/name}","comments_url":"https://api.github.com/repos/Jasig/cas/issues/1333/comments","events_url":"https://api.github.com/repos/Jasig/cas/issues/1333/events","html_url":"https://github.com/Jasig/cas/pull/1333","id":120604197,"number":1333,"title":"Concurrency fix - Race condition in MemCacheTicketRegistry","user":{"login":"tduehr","id":37545,"avatar_url":"https://avatars.githubusercontent.com/u/37545?v=3","gravatar_id":"","url":"https://api.github.com/users/tduehr","html_url":"https://github.com/tduehr","followers_url":"https://api.github.com/users/tduehr/followers","following_url":"https://api.github.com/users/tduehr/following{/other_user}","gists_url":"https://api.github.com/users/tduehr/gists{/gist_id}","starred_url":"https://api.github.com/users/tduehr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tduehr/subscriptions","organizations_url":"https://api.github.com/users/tduehr/orgs","repos_url":"https://api.github.com/users/tduehr/repos","events_url":"https://api.github.com/users/tduehr/events{/privacy}","received_events_url":"https://api.github.com/users/tduehr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Jasig/cas/milestones/15","html_url":"https://github.com/Jasig/cas/milestones/4.3.0","labels_url":"https://api.github.com/repos/Jasig/cas/milestones/15/labels","id":1349862,"number":15,"title":"4.3.0","description":"CAS version 4.3.0 minor release","creator":{"login":"mmoayyed","id":1205228,"avatar_url":"https://avatars.githubusercontent.com/u/1205228?v=3","gravatar_id":"","url":"https://api.github.com/users/mmoayyed","html_url":"https://github.com/mmoayyed","followers_url":"https://api.github.com/users/mmoayyed/followers","following_url":"https://api.github.com/users/mmoayyed/following{/other_user}","gists_url":"https://api.github.com/users/mmoayyed/gists{/gist_id}","starred_url":"https://api.github.com/users/mmoayyed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmoayyed/subscriptions","organizations_url":"https://api.github.com/users/mmoayyed/orgs","repos_url":"https://api.github.com/users/mmoayyed/repos","events_url":"https://api.github.com/users/mmoayyed/events{/privacy}","received_events_url":"https://api.github.com/users/mmoayyed/received_events","type":"User","site_admin":false},"open_issues":18,"closed_issues":69,"state":"open","created_at":"2015-10-12T01:28:38Z","updated_at":"2016-02-05T18:55:39Z","due_on":"2016-04-19T07:00:00Z","closed_at":null},"comments":14,"created_at":"2015-12-06T03:11:20Z","updated_at":"2016-02-05T19:40:38Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Jasig/cas/pulls/1333","html_url":"https://github.com/Jasig/cas/pull/1333","diff_url":"https://github.com/Jasig/cas/pull/1333.diff","patch_url":"https://github.com/Jasig/cas/pull/1333.patch"},"body":"Closes #875\r\nAdds an artificial mutex to syncronize on a ticket without having one.'\r\nThis solution requires Java8. #1332 "},"comment":{"url":"https://api.github.com/repos/Jasig/cas/issues/comments/180518722","html_url":"https://github.com/Jasig/cas/pull/1333#issuecomment-180518722","issue_url":"https://api.github.com/repos/Jasig/cas/issues/1333","id":180518722,"user":{"login":"frett","id":47818,"avatar_url":"https://avatars.githubusercontent.com/u/47818?v=3","gravatar_id":"","url":"https://api.github.com/users/frett","html_url":"https://github.com/frett","followers_url":"https://api.github.com/users/frett/followers","following_url":"https://api.github.com/users/frett/following{/other_user}","gists_url":"https://api.github.com/users/frett/gists{/gist_id}","starred_url":"https://api.github.com/users/frett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frett/subscriptions","organizations_url":"https://api.github.com/users/frett/orgs","repos_url":"https://api.github.com/users/frett/repos","events_url":"https://api.github.com/users/frett/events{/privacy}","received_events_url":"https://api.github.com/users/frett/received_events","type":"User","site_admin":false},"created_at":"2016-02-05T19:40:38Z","updated_at":"2016-02-05T19:40:38Z","body":"I just read over #875 I don't think currently this will fully solve the concurrency issues in the `MemCacheTicketRegistry`. The issue sounds very similar to the JPA deadlock issues I was seeing and fixed by using `PessimisticLocking` in JPA.\r\n\r\nThere will still be race conditions within other Ticket related methods, such as `CentralAuthenticationServiceImpl.grantServiceTicket()`. That method fetches the TGT using `getTicket()` (which will be synchronized), but then releases that lock and updates the TGT locally before storing the updates back in the registry. Multiple transactions wouldn't be correctly synchronized in this use case.\r\n\r\nIt would be possible to synchronize the entire `grantServiceTicket()` operation with the same lock and it would protect against this use case, but there may be more with our current model of fetching a ticket from the registry, modifying it outside of the registry, then sending the new complete state back into the registry."}}