{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/4130","labels_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/4130/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/4130/comments","events_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/4130/events","html_url":"https://github.com/spring-projects/spring-boot/issues/4130","id":110570049,"number":4130,"title":"Deadlock when receiving first http request while shutting down context.","user":{"login":"magJ","id":1804354,"avatar_url":"https://avatars.githubusercontent.com/u/1804354?v=3","gravatar_id":"","url":"https://api.github.com/users/magJ","html_url":"https://github.com/magJ","followers_url":"https://api.github.com/users/magJ/followers","following_url":"https://api.github.com/users/magJ/following{/other_user}","gists_url":"https://api.github.com/users/magJ/gists{/gist_id}","starred_url":"https://api.github.com/users/magJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magJ/subscriptions","organizations_url":"https://api.github.com/users/magJ/orgs","repos_url":"https://api.github.com/users/magJ/repos","events_url":"https://api.github.com/users/magJ/events{/privacy}","received_events_url":"https://api.github.com/users/magJ/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/spring-projects/spring-boot/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"wilkinsona","id":914682,"avatar_url":"https://avatars.githubusercontent.com/u/914682?v=3","gravatar_id":"","url":"https://api.github.com/users/wilkinsona","html_url":"https://github.com/wilkinsona","followers_url":"https://api.github.com/users/wilkinsona/followers","following_url":"https://api.github.com/users/wilkinsona/following{/other_user}","gists_url":"https://api.github.com/users/wilkinsona/gists{/gist_id}","starred_url":"https://api.github.com/users/wilkinsona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilkinsona/subscriptions","organizations_url":"https://api.github.com/users/wilkinsona/orgs","repos_url":"https://api.github.com/users/wilkinsona/repos","events_url":"https://api.github.com/users/wilkinsona/events{/privacy}","received_events_url":"https://api.github.com/users/wilkinsona/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/spring-projects/spring-boot/milestones/47","html_url":"https://github.com/spring-projects/spring-boot/milestones/1.2.7","labels_url":"https://api.github.com/repos/spring-projects/spring-boot/milestones/47/labels","id":1315350,"number":47,"title":"1.2.7","description":"","creator":{"login":"philwebb","id":519772,"avatar_url":"https://avatars.githubusercontent.com/u/519772?v=3","gravatar_id":"","url":"https://api.github.com/users/philwebb","html_url":"https://github.com/philwebb","followers_url":"https://api.github.com/users/philwebb/followers","following_url":"https://api.github.com/users/philwebb/following{/other_user}","gists_url":"https://api.github.com/users/philwebb/gists{/gist_id}","starred_url":"https://api.github.com/users/philwebb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philwebb/subscriptions","organizations_url":"https://api.github.com/users/philwebb/orgs","repos_url":"https://api.github.com/users/philwebb/repos","events_url":"https://api.github.com/users/philwebb/events{/privacy}","received_events_url":"https://api.github.com/users/philwebb/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":26,"state":"closed","created_at":"2015-09-20T19:21:26Z","updated_at":"2015-10-16T13:37:00Z","due_on":null,"closed_at":"2015-10-16T13:37:00Z"},"comments":4,"created_at":"2015-10-09T01:04:22Z","updated_at":"2015-11-06T21:27:47Z","closed_at":"2015-10-09T11:42:40Z","body":"If we begin to shutdown the spring context while we receive the first HTTP request, spring-boot can deadlock.\r\nIt seems that the first HTTP request kicks off some initialization that grabs a lock on the AnnotationConfigEmbeddedWebApplicationContext.\r\n\r\nWe saw this in a production application, but I managed to replicate it with some success in a demo application:\r\n\r\nhttps://github.com/magJ/spring-boot-deadlock-issue-4130/\r\n\r\nIt might take a few attempts, but the above application should deadlock eventually.\r\n\r\nSpring boot version: 1.2.4-RELEASE\r\nJava Version: 1.8.0_20\r\n\r\nI also have a log sample and thread dump of what we saw in out prod application:\r\nhttps://gist.github.com/magJ/21b075fe38fdace94be8\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-boot/issues/comments/154546870","html_url":"https://github.com/spring-projects/spring-boot/issues/4130#issuecomment-154546870","issue_url":"https://api.github.com/repos/spring-projects/spring-boot/issues/4130","id":154546870,"user":{"login":"philwebb","id":519772,"avatar_url":"https://avatars.githubusercontent.com/u/519772?v=3","gravatar_id":"","url":"https://api.github.com/users/philwebb","html_url":"https://github.com/philwebb","followers_url":"https://api.github.com/users/philwebb/followers","following_url":"https://api.github.com/users/philwebb/following{/other_user}","gists_url":"https://api.github.com/users/philwebb/gists{/gist_id}","starred_url":"https://api.github.com/users/philwebb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philwebb/subscriptions","organizations_url":"https://api.github.com/users/philwebb/orgs","repos_url":"https://api.github.com/users/philwebb/repos","events_url":"https://api.github.com/users/philwebb/events{/privacy}","received_events_url":"https://api.github.com/users/philwebb/received_events","type":"User","site_admin":false},"created_at":"2015-11-06T21:27:47Z","updated_at":"2015-11-06T21:27:47Z","body":"@magJ Our original fix for this caused some other issues so we've needed to change things. I've tested your original deadlock app and it seems fine but if you get a chance could you please try the latest 1.2.8.BUILD-SNAPSHOT version?"}}