{"action":"created","issue":{"url":"https://api.github.com/repos/reactor/reactor-netty/issues/90","repository_url":"https://api.github.com/repos/reactor/reactor-netty","labels_url":"https://api.github.com/repos/reactor/reactor-netty/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/reactor/reactor-netty/issues/90/comments","events_url":"https://api.github.com/repos/reactor/reactor-netty/issues/90/events","html_url":"https://github.com/reactor/reactor-netty/issues/90","id":227651661,"node_id":"MDU6SXNzdWUyMjc2NTE2NjE=","number":90,"title":"calling BlockingNettyContext.shutdown() does not clear handlers","user":{"login":"bclozel","id":103264,"node_id":"MDQ6VXNlcjEwMzI2NA==","avatar_url":"https://avatars2.githubusercontent.com/u/103264?v=4","gravatar_id":"","url":"https://api.github.com/users/bclozel","html_url":"https://github.com/bclozel","followers_url":"https://api.github.com/users/bclozel/followers","following_url":"https://api.github.com/users/bclozel/following{/other_user}","gists_url":"https://api.github.com/users/bclozel/gists{/gist_id}","starred_url":"https://api.github.com/users/bclozel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bclozel/subscriptions","organizations_url":"https://api.github.com/users/bclozel/orgs","repos_url":"https://api.github.com/users/bclozel/repos","events_url":"https://api.github.com/users/bclozel/events{/privacy}","received_events_url":"https://api.github.com/users/bclozel/received_events","type":"User","site_admin":false},"labels":[{"id":427159015,"node_id":"MDU6TGFiZWw0MjcxNTkwMTU=","url":"https://api.github.com/repos/reactor/reactor-netty/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/reactor/reactor-netty/milestones/31","html_url":"https://github.com/reactor/reactor-netty/milestone/31","labels_url":"https://api.github.com/repos/reactor/reactor-netty/milestones/31/labels","id":3652083,"node_id":"MDk6TWlsZXN0b25lMzY1MjA4Mw==","number":31,"title":"0.8.1.RELEASE","description":"","creator":{"login":"violetagg","id":696661,"node_id":"MDQ6VXNlcjY5NjY2MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/696661?v=4","gravatar_id":"","url":"https://api.github.com/users/violetagg","html_url":"https://github.com/violetagg","followers_url":"https://api.github.com/users/violetagg/followers","following_url":"https://api.github.com/users/violetagg/following{/other_user}","gists_url":"https://api.github.com/users/violetagg/gists{/gist_id}","starred_url":"https://api.github.com/users/violetagg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/violetagg/subscriptions","organizations_url":"https://api.github.com/users/violetagg/orgs","repos_url":"https://api.github.com/users/violetagg/repos","events_url":"https://api.github.com/users/violetagg/events{/privacy}","received_events_url":"https://api.github.com/users/violetagg/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":3,"state":"open","created_at":"2018-09-13T15:46:41Z","updated_at":"2018-10-09T08:16:03Z","due_on":"2018-10-10T07:00:00Z","closed_at":null},"comments":7,"created_at":"2017-05-10T11:41:17Z","updated_at":"2018-10-09T08:16:03Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"This issue is linked with spring-projects/spring-boot#9146\r\nWhen trying to fix devtools support in Spring Boot (i.e. stopping the server, recreating a new Spring context and starting a new server - all that without stopping the JVM), I've found that disposing a server and starting a new one has not the expected behavior.\r\n\r\nHere's a repro case that shows the behavior:\r\n\r\n```java\r\npackage com.example.demo;\r\n\r\nimport org.assertj.core.api.Assertions;\r\nimport org.junit.Test;\r\nimport reactor.ipc.netty.http.client.HttpClient;\r\nimport reactor.ipc.netty.http.client.HttpClientResponse;\r\nimport reactor.ipc.netty.http.server.HttpServer;\r\nimport reactor.ipc.netty.tcp.BlockingNettyContext;\r\n\r\nimport org.springframework.http.ResponseEntity;\r\nimport org.springframework.web.client.RestTemplate;\r\n\r\npublic class ReactorNettyRestart {\r\n\r\n\t@Test\r\n\tpublic void testRestart() {\r\n\t\t// start a first server with a handler that answers HTTP 200 OK\r\n\t\tBlockingNettyContext context = HttpServer.create(8080)\r\n\t\t\t\t.start((req, resp) -> resp.status(200).send());\r\n\r\n\t\tHttpClientResponse response = HttpClient.create(8080).get(\"/\").block();\r\n\r\n\t\t// checking the response status, OK\r\n\t\tAssertions.assertThat(response.status().code()).isEqualTo(200);\r\n\t\t// dispose the Netty context and wait for the channel close\r\n\t\tcontext.shutdown();\r\n\t\tcontext.getContext().onClose().block();\r\n\r\n\t\t// create a totally new server instance, with a different handler that answers HTTP 201\r\n\t\tcontext = HttpServer.create(8080)\r\n\t\t\t\t.start((req, resp) -> resp.status(201).send());\r\n\r\n\t\tresponse = HttpClient.create(8080).get(\"/\").block();\r\n\r\n\t\t// fails, response status is 200 and debugging shows the the previous handler is called\r\n\t\tAssertions.assertThat(response.status().code()).isEqualTo(201);\r\n\t\tcontext.shutdown();\r\n\t\tcontext.getContext().onClose().block();\r\n\t}\r\n\r\n\t@Test\r\n\tpublic void testRestartBlockingClient() {\r\n\r\n\t\tRestTemplate template = new RestTemplate();\r\n\t\t// start a first server with a handler that answers HTTP 200 OK\r\n\t\tBlockingNettyContext context = HttpServer.create(8080)\r\n\t\t\t\t.start((req, resp) -> resp.status(200).send());\r\n\r\n\t\tResponseEntity<String> response = template.getForEntity(\"http://localhost:8080/\", String.class);\r\n\r\n\t\t// checking the response status, OK\r\n\t\tAssertions.assertThat(response.getStatusCode().value()).isEqualTo(200);\r\n\t\t// dispose the Netty context and wait for the channel close\r\n\t\tcontext.shutdown();\r\n\t\tcontext.getContext().onClose().block();\r\n\r\n\t\t// create a totally new server instance, with a different handler that answers HTTP 201\r\n\t\tcontext = HttpServer.create(8080)\r\n\t\t\t\t.start((req, resp) -> resp.status(201).send());\r\n\r\n\t\tresponse = template.getForEntity(\"http://localhost:8080/\", String.class);\r\n\r\n\t\t// fails, response status is 200 and debugging shows the the previous handler is called\r\n\t\tAssertions.assertThat(response.getStatusCode().value()).isEqualTo(201);\r\n\t\tcontext.shutdown();\r\n\t\tcontext.getContext().onClose().block();\r\n\t}\r\n\r\n}\r\n```\r\n\r\nAm I misusing the `HttpServer` API?\r\nIs there some state that I forgot to clear?"},"comment":{"url":"https://api.github.com/repos/reactor/reactor-netty/issues/comments/428102355","html_url":"https://github.com/reactor/reactor-netty/issues/90#issuecomment-428102355","issue_url":"https://api.github.com/repos/reactor/reactor-netty/issues/90","id":428102355,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODEwMjM1NQ==","user":{"login":"sdeleuze","id":141109,"node_id":"MDQ6VXNlcjE0MTEwOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/141109?v=4","gravatar_id":"","url":"https://api.github.com/users/sdeleuze","html_url":"https://github.com/sdeleuze","followers_url":"https://api.github.com/users/sdeleuze/followers","following_url":"https://api.github.com/users/sdeleuze/following{/other_user}","gists_url":"https://api.github.com/users/sdeleuze/gists{/gist_id}","starred_url":"https://api.github.com/users/sdeleuze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdeleuze/subscriptions","organizations_url":"https://api.github.com/users/sdeleuze/orgs","repos_url":"https://api.github.com/users/sdeleuze/repos","events_url":"https://api.github.com/users/sdeleuze/events{/privacy}","received_events_url":"https://api.github.com/users/sdeleuze/received_events","type":"User","site_admin":false},"created_at":"2018-10-09T08:16:03Z","updated_at":"2018-10-09T08:16:03Z","author_association":"CONTRIBUTOR","body":"The issue still occurs with latest snapshot, you you want to debug that I have created a branch that reproduces the issue: https://github.com/spring-projects/spring-fu/tree/reactor-netty-http-resources. You can run for example `JacksonDslTests` it fails without `HttpResources.reset()` at the end of each test."}}
{"actor":{"display_login":"sdeleuze"}}