{"action":"closed","number":44,"pull_request":{"url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/pulls/44","id":29913671,"html_url":"https://github.com/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/pull/44","diff_url":"https://github.com/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/pull/44.diff","patch_url":"https://github.com/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/pull/44.patch","issue_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/issues/44","number":44,"state":"closed","locked":false,"title":"Fixed concurrency issues","user":{"login":"promontis","id":374646,"avatar_url":"https://avatars.githubusercontent.com/u/374646?v=3","gravatar_id":"","url":"https://api.github.com/users/promontis","html_url":"https://github.com/promontis","followers_url":"https://api.github.com/users/promontis/followers","following_url":"https://api.github.com/users/promontis/following{/other_user}","gists_url":"https://api.github.com/users/promontis/gists{/gist_id}","starred_url":"https://api.github.com/users/promontis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/promontis/subscriptions","organizations_url":"https://api.github.com/users/promontis/orgs","repos_url":"https://api.github.com/users/promontis/repos","events_url":"https://api.github.com/users/promontis/events{/privacy}","received_events_url":"https://api.github.com/users/promontis/received_events","type":"User","site_admin":false},"body":"#42 \r\n\r\nMy mobile app is very async like (serving up multiple requests on startup). When the token is expired, I try to refresh the token by using the refresh_token. From the log I can see that this happens three times and has the following flow:\r\n\r\n1. remove old token and create new token\r\n2. remove old token, which is already gone, concurrency exception\r\n3. remove old token, which is already gone, concurrency exception\r\n\r\nFrom this point it seems new calls are all invalid... probably because no good token is returned.\r\n\r\nI've fixed this issue by catching the concurrency exception and removing the token from the context. The new flow:\r\n\r\n1. remove old token and create new token\r\n2. remove old token, which is already gone, concurrency exception is caught, remove token from context, create new token\r\n3. remove old token, which is already gone, concurrency exception is caught, remove token from context, create new token\r\n\r\nIt *does* create 3 tokens now, where I eventually will use the last one. I don't think this is bad, but you might think differently. From what I understand, the token I'll use just works (it does), and the other two ones are just in the database. Eventually, by using the token cleanup class, those token will be removed from the database. Seems to be ok? ","created_at":"2015-02-24T16:43:26Z","updated_at":"2015-02-24T18:49:07Z","closed_at":"2015-02-24T18:49:07Z","merged_at":null,"merge_commit_sha":"76662ce89226f2d081908043acc257fdc9d040c6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/pulls/44/commits","review_comments_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/pulls/44/comments","review_comment_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/issues/44/comments","statuses_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/statuses/6b0bcbb0e3ea3471a3e9b3db471a4f2e295b44c8","head":{"label":"promontis:master","ref":"master","sha":"6b0bcbb0e3ea3471a3e9b3db471a4f2e295b44c8","user":{"login":"promontis","id":374646,"avatar_url":"https://avatars.githubusercontent.com/u/374646?v=3","gravatar_id":"","url":"https://api.github.com/users/promontis","html_url":"https://github.com/promontis","followers_url":"https://api.github.com/users/promontis/followers","following_url":"https://api.github.com/users/promontis/following{/other_user}","gists_url":"https://api.github.com/users/promontis/gists{/gist_id}","starred_url":"https://api.github.com/users/promontis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/promontis/subscriptions","organizations_url":"https://api.github.com/users/promontis/orgs","repos_url":"https://api.github.com/users/promontis/repos","events_url":"https://api.github.com/users/promontis/events{/privacy}","received_events_url":"https://api.github.com/users/promontis/received_events","type":"User","site_admin":false},"repo":{"id":31269547,"name":"Thinktecture.IdentityServer3.EntityFramework","full_name":"promontis/Thinktecture.IdentityServer3.EntityFramework","owner":{"login":"promontis","id":374646,"avatar_url":"https://avatars.githubusercontent.com/u/374646?v=3","gravatar_id":"","url":"https://api.github.com/users/promontis","html_url":"https://github.com/promontis","followers_url":"https://api.github.com/users/promontis/followers","following_url":"https://api.github.com/users/promontis/following{/other_user}","gists_url":"https://api.github.com/users/promontis/gists{/gist_id}","starred_url":"https://api.github.com/users/promontis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/promontis/subscriptions","organizations_url":"https://api.github.com/users/promontis/orgs","repos_url":"https://api.github.com/users/promontis/repos","events_url":"https://api.github.com/users/promontis/events{/privacy}","received_events_url":"https://api.github.com/users/promontis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/promontis/Thinktecture.IdentityServer3.EntityFramework","description":"EntityFramework persistence layer for IdentityServer v3","fork":true,"url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework","forks_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/forks","keys_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/teams","hooks_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/hooks","issue_events_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/issues/events{/number}","events_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/events","assignees_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/assignees{/user}","branches_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/branches{/branch}","tags_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/tags","blobs_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/git/refs{/sha}","trees_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/statuses/{sha}","languages_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/languages","stargazers_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/stargazers","contributors_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/contributors","subscribers_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/subscribers","subscription_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/subscription","commits_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/commits{/sha}","git_commits_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/git/commits{/sha}","comments_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/comments{/number}","issue_comment_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/issues/comments{/number}","contents_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/contents/{+path}","compare_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/merges","archive_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/downloads","issues_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/issues{/number}","pulls_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/pulls{/number}","milestones_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/milestones{/number}","notifications_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/labels{/name}","releases_url":"https://api.github.com/repos/promontis/Thinktecture.IdentityServer3.EntityFramework/releases{/id}","created_at":"2015-02-24T16:34:02Z","updated_at":"2015-02-24T16:35:25Z","pushed_at":"2015-02-24T16:35:25Z","git_url":"git://github.com/promontis/Thinktecture.IdentityServer3.EntityFramework.git","ssh_url":"git@github.com:promontis/Thinktecture.IdentityServer3.EntityFramework.git","clone_url":"https://github.com/promontis/Thinktecture.IdentityServer3.EntityFramework.git","svn_url":"https://github.com/promontis/Thinktecture.IdentityServer3.EntityFramework","homepage":null,"size":3215,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"IdentityServer:master","ref":"master","sha":"9bb9639b6d05577aa949ac0760e1b13ae693315a","user":{"login":"IdentityServer","id":10635672,"avatar_url":"https://avatars.githubusercontent.com/u/10635672?v=3","gravatar_id":"","url":"https://api.github.com/users/IdentityServer","html_url":"https://github.com/IdentityServer","followers_url":"https://api.github.com/users/IdentityServer/followers","following_url":"https://api.github.com/users/IdentityServer/following{/other_user}","gists_url":"https://api.github.com/users/IdentityServer/gists{/gist_id}","starred_url":"https://api.github.com/users/IdentityServer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IdentityServer/subscriptions","organizations_url":"https://api.github.com/users/IdentityServer/orgs","repos_url":"https://api.github.com/users/IdentityServer/repos","events_url":"https://api.github.com/users/IdentityServer/events{/privacy}","received_events_url":"https://api.github.com/users/IdentityServer/received_events","type":"Organization","site_admin":false},"repo":{"id":21913808,"name":"Thinktecture.IdentityServer3.EntityFramework","full_name":"IdentityServer/Thinktecture.IdentityServer3.EntityFramework","owner":{"login":"IdentityServer","id":10635672,"avatar_url":"https://avatars.githubusercontent.com/u/10635672?v=3","gravatar_id":"","url":"https://api.github.com/users/IdentityServer","html_url":"https://github.com/IdentityServer","followers_url":"https://api.github.com/users/IdentityServer/followers","following_url":"https://api.github.com/users/IdentityServer/following{/other_user}","gists_url":"https://api.github.com/users/IdentityServer/gists{/gist_id}","starred_url":"https://api.github.com/users/IdentityServer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IdentityServer/subscriptions","organizations_url":"https://api.github.com/users/IdentityServer/orgs","repos_url":"https://api.github.com/users/IdentityServer/repos","events_url":"https://api.github.com/users/IdentityServer/events{/privacy}","received_events_url":"https://api.github.com/users/IdentityServer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/IdentityServer/Thinktecture.IdentityServer3.EntityFramework","description":"EntityFramework persistence layer for IdentityServer v3","fork":false,"url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework","forks_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/forks","keys_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/teams","hooks_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/hooks","issue_events_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/issues/events{/number}","events_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/events","assignees_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/assignees{/user}","branches_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/branches{/branch}","tags_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/tags","blobs_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/git/refs{/sha}","trees_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/statuses/{sha}","languages_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/languages","stargazers_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/stargazers","contributors_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/contributors","subscribers_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/subscribers","subscription_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/subscription","commits_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/commits{/sha}","git_commits_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/git/commits{/sha}","comments_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/comments{/number}","issue_comment_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/issues/comments{/number}","contents_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/contents/{+path}","compare_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/merges","archive_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/downloads","issues_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/issues{/number}","pulls_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/pulls{/number}","milestones_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/milestones{/number}","notifications_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/labels{/name}","releases_url":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/releases{/id}","created_at":"2014-07-16T19:18:51Z","updated_at":"2015-02-24T15:02:14Z","pushed_at":"2015-02-17T14:27:46Z","git_url":"git://github.com/IdentityServer/Thinktecture.IdentityServer3.EntityFramework.git","ssh_url":"git@github.com:IdentityServer/Thinktecture.IdentityServer3.EntityFramework.git","clone_url":"https://github.com/IdentityServer/Thinktecture.IdentityServer3.EntityFramework.git","svn_url":"https://github.com/IdentityServer/Thinktecture.IdentityServer3.EntityFramework","homepage":null,"size":3730,"stargazers_count":15,"watchers_count":15,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":5,"forks":21,"open_issues":5,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/pulls/44"},"html":{"href":"https://github.com/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/pull/44"},"issue":{"href":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/issues/44"},"comments":{"href":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/issues/44/comments"},"review_comments":{"href":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/pulls/44/comments"},"review_comment":{"href":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/pulls/44/commits"},"statuses":{"href":"https://api.github.com/repos/IdentityServer/Thinktecture.IdentityServer3.EntityFramework/statuses/6b0bcbb0e3ea3471a3e9b3db471a4f2e295b44c8"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":2,"review_comments":0,"commits":1,"additions":28,"deletions":10,"changed_files":1}}