{"action":"closed","issue":{"url":"https://api.github.com/repos/grails/grails-data-mapping/issues/79","labels_url":"https://api.github.com/repos/grails/grails-data-mapping/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/grails/grails-data-mapping/issues/79/comments","events_url":"https://api.github.com/repos/grails/grails-data-mapping/issues/79/events","html_url":"https://github.com/grails/grails-data-mapping/issues/79","id":81332829,"number":79,"title":"GPMONGODB-398: Exception after mongo DuplicateKeyException causes endless loop when combined with mapping 500 codes to a controller action","user":{"login":"graemerocher","id":66626,"avatar_url":"https://avatars.githubusercontent.com/u/66626?v=3","gravatar_id":"","url":"https://api.github.com/users/graemerocher","html_url":"https://github.com/graemerocher","followers_url":"https://api.github.com/users/graemerocher/followers","following_url":"https://api.github.com/users/graemerocher/following{/other_user}","gists_url":"https://api.github.com/users/graemerocher/gists{/gist_id}","starred_url":"https://api.github.com/users/graemerocher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graemerocher/subscriptions","organizations_url":"https://api.github.com/users/graemerocher/orgs","repos_url":"https://api.github.com/users/graemerocher/repos","events_url":"https://api.github.com/users/graemerocher/events{/privacy}","received_events_url":"https://api.github.com/users/graemerocher/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/grails/grails-data-mapping/labels/Bug","name":"Bug","color":"fc2929"},{"url":"https://api.github.com/repos/grails/grails-data-mapping/labels/Major","name":"Major","color":"f7c6c7"},{"url":"https://api.github.com/repos/grails/grails-data-mapping/labels/mongodb","name":"mongodb","color":"bfdadc"}],"state":"closed","locked":false,"assignee":{"login":"graemerocher","id":66626,"avatar_url":"https://avatars.githubusercontent.com/u/66626?v=3","gravatar_id":"","url":"https://api.github.com/users/graemerocher","html_url":"https://github.com/graemerocher","followers_url":"https://api.github.com/users/graemerocher/followers","following_url":"https://api.github.com/users/graemerocher/following{/other_user}","gists_url":"https://api.github.com/users/graemerocher/gists{/gist_id}","starred_url":"https://api.github.com/users/graemerocher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graemerocher/subscriptions","organizations_url":"https://api.github.com/users/graemerocher/orgs","repos_url":"https://api.github.com/users/graemerocher/repos","events_url":"https://api.github.com/users/graemerocher/events{/privacy}","received_events_url":"https://api.github.com/users/graemerocher/received_events","type":"User","site_admin":false},"milestone":null,"comments":0,"created_at":"2014-07-30T11:31:09Z","updated_at":"2015-11-19T14:30:37Z","closed_at":"2015-11-19T14:30:37Z","body":"\nOriginal Reporter: brittma\nEnvironment: Grails 2.3.8\nVersion: 3.0.1\nMigrated From: http://jira.grails.org/browse/GPMONGODB-398\n\nThis issue is similar to https://jira.grails.org/browse/GPMONGODB-256\nand https://jira.grails.org/browse/GRAILS-3257 however we are still seeing this issue despite the mentioned fixes.\n\nGetting StackOverflowError when an org.springframework.dao.DuplicateKeyException is thrown and a 500 error code is mapped to an ErrorController. After reading the above referenced issues, we put a fix in the ErrorController to clear the session in the afterInterceptor:\n\ndef afterInterceptor = {\n\t   Item.withSession {s->s.clear()}\n}\n\nClearing the session prevents the endless loop from occurring."}}