{"action":"created","issue":{"url":"https://api.github.com/repos/netty/netty/issues/7724","repository_url":"https://api.github.com/repos/netty/netty","labels_url":"https://api.github.com/repos/netty/netty/issues/7724/labels{/name}","comments_url":"https://api.github.com/repos/netty/netty/issues/7724/comments","events_url":"https://api.github.com/repos/netty/netty/issues/7724/events","html_url":"https://github.com/netty/netty/issues/7724","id":297648695,"number":7724,"title":"SSL connection not closed properly after handshake failure in v4.1.21","user":{"login":"jianglai","id":855266,"avatar_url":"https://avatars0.githubusercontent.com/u/855266?v=4","gravatar_id":"","url":"https://api.github.com/users/jianglai","html_url":"https://github.com/jianglai","followers_url":"https://api.github.com/users/jianglai/followers","following_url":"https://api.github.com/users/jianglai/following{/other_user}","gists_url":"https://api.github.com/users/jianglai/gists{/gist_id}","starred_url":"https://api.github.com/users/jianglai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jianglai/subscriptions","organizations_url":"https://api.github.com/users/jianglai/orgs","repos_url":"https://api.github.com/users/jianglai/repos","events_url":"https://api.github.com/users/jianglai/events{/privacy}","received_events_url":"https://api.github.com/users/jianglai/received_events","type":"User","site_admin":false},"labels":[{"id":185727,"url":"https://api.github.com/repos/netty/netty/labels/defect","name":"defect","color":"e11d21","default":false}],"state":"open","locked":false,"assignee":{"login":"normanmaurer","id":439362,"avatar_url":"https://avatars3.githubusercontent.com/u/439362?v=4","gravatar_id":"","url":"https://api.github.com/users/normanmaurer","html_url":"https://github.com/normanmaurer","followers_url":"https://api.github.com/users/normanmaurer/followers","following_url":"https://api.github.com/users/normanmaurer/following{/other_user}","gists_url":"https://api.github.com/users/normanmaurer/gists{/gist_id}","starred_url":"https://api.github.com/users/normanmaurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanmaurer/subscriptions","organizations_url":"https://api.github.com/users/normanmaurer/orgs","repos_url":"https://api.github.com/users/normanmaurer/repos","events_url":"https://api.github.com/users/normanmaurer/events{/privacy}","received_events_url":"https://api.github.com/users/normanmaurer/received_events","type":"User","site_admin":false},"assignees":[{"login":"normanmaurer","id":439362,"avatar_url":"https://avatars3.githubusercontent.com/u/439362?v=4","gravatar_id":"","url":"https://api.github.com/users/normanmaurer","html_url":"https://github.com/normanmaurer","followers_url":"https://api.github.com/users/normanmaurer/followers","following_url":"https://api.github.com/users/normanmaurer/following{/other_user}","gists_url":"https://api.github.com/users/normanmaurer/gists{/gist_id}","starred_url":"https://api.github.com/users/normanmaurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanmaurer/subscriptions","organizations_url":"https://api.github.com/users/normanmaurer/orgs","repos_url":"https://api.github.com/users/normanmaurer/repos","events_url":"https://api.github.com/users/normanmaurer/events{/privacy}","received_events_url":"https://api.github.com/users/normanmaurer/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/netty/netty/milestones/183","html_url":"https://github.com/netty/netty/milestone/183","labels_url":"https://api.github.com/repos/netty/netty/milestones/183/labels","id":3089421,"number":183,"title":"4.1.22.Final","description":"","creator":{"login":"normanmaurer","id":439362,"avatar_url":"https://avatars3.githubusercontent.com/u/439362?v=4","gravatar_id":"","url":"https://api.github.com/users/normanmaurer","html_url":"https://github.com/normanmaurer","followers_url":"https://api.github.com/users/normanmaurer/followers","following_url":"https://api.github.com/users/normanmaurer/following{/other_user}","gists_url":"https://api.github.com/users/normanmaurer/gists{/gist_id}","starred_url":"https://api.github.com/users/normanmaurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanmaurer/subscriptions","organizations_url":"https://api.github.com/users/normanmaurer/orgs","repos_url":"https://api.github.com/users/normanmaurer/repos","events_url":"https://api.github.com/users/normanmaurer/events{/privacy}","received_events_url":"https://api.github.com/users/normanmaurer/received_events","type":"User","site_admin":false},"open_issues":57,"closed_issues":24,"state":"open","created_at":"2018-02-05T13:05:20Z","updated_at":"2018-02-16T10:54:34Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2018-02-16T00:48:14Z","updated_at":"2018-02-16T13:51:15Z","closed_at":null,"author_association":"NONE","body":"### Expected behavior\r\nWhen SSL handshake fails, the connection is closed.\r\n\r\n### Actual behavior\r\nEven though the SSL engine is closed, the connection itself is not closed.\r\n\r\n### Steps to reproduce\r\nSee below.\r\n\r\n### Minimal yet complete reproducer code (or URL to code)\r\nRun the demo code [here](https://github.com/jianglai/netty-bug/blob/master/src/main/java/test/Main.java). The program hangs and \"Channel closed.\" is never printed to stdout. If you change the Netty version in the pom.xml file to 4.1.17, the channel is closed as expected.\r\n\r\n### Netty version\r\n4.1.21\r\n\r\n### JVM version (e.g. `java -version`)\r\nopenjdk version \"1.8.0_112-google-v7\"\r\nOpenJDK Runtime Environment (build 1.8.0_112-google-v7-181886826-181741640)\r\nOpenJDK 64-Bit Server VM (build 25.112-b01, mixed mode)\r\n\r\n### OS version (e.g. `uname -a`)\r\nLinux 4.9.0-5-amd64 SMP Debian 4.9.65-3+deb9u2 (2018-01-04) x86_64 GNU/Linux\r\n\r\nI think this is a regression introduced by https://github.com/netty/netty/commit/978a46cc0a5242702f248842f6feb97b8fbe0123.\r\n\r\nMore specifically, [`handshakePromise.tryFailure`](https://github.com/netty/netty/blob/4.1/handler/src/main/java/io/netty/handler/ssl/SslHandler.java#L1183)  is called within the `try` clause, and the promise is set to failure. Later in the `finally` clause, [`setHandshakeFailure`](https://github.com/netty/netty/blob/4.1/handler/src/main/java/io/netty/handler/ssl/SslHandler.java#L1529) calls [`notifyHandshakeFailure`](https://github.com/netty/netty/blob/4.1/handler/src/main/java/io/netty/handler/ssl/SslHandler.java#L1542]), which is no longer calling [`SslUtils.notifyHandshakeFailure`](https://github.com/netty/netty/blob/4.1/handler/src/main/java/io/netty/handler/ssl/SslUtils.java#L320) because the promise has been marked as finished. Therefore `ctx.close()` is never called to close the channel."},"comment":{"url":"https://api.github.com/repos/netty/netty/issues/comments/366240204","html_url":"https://github.com/netty/netty/issues/7724#issuecomment-366240204","issue_url":"https://api.github.com/repos/netty/netty/issues/7724","id":366240204,"user":{"login":"jianglai","id":855266,"avatar_url":"https://avatars0.githubusercontent.com/u/855266?v=4","gravatar_id":"","url":"https://api.github.com/users/jianglai","html_url":"https://github.com/jianglai","followers_url":"https://api.github.com/users/jianglai/followers","following_url":"https://api.github.com/users/jianglai/following{/other_user}","gists_url":"https://api.github.com/users/jianglai/gists{/gist_id}","starred_url":"https://api.github.com/users/jianglai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jianglai/subscriptions","organizations_url":"https://api.github.com/users/jianglai/orgs","repos_url":"https://api.github.com/users/jianglai/repos","events_url":"https://api.github.com/users/jianglai/events{/privacy}","received_events_url":"https://api.github.com/users/jianglai/received_events","type":"User","site_admin":false},"created_at":"2018-02-16T13:51:15Z","updated_at":"2018-02-16T13:51:15Z","author_association":"NONE","body":"Thanks for the quick turnaround!"}}
{"actor":{"display_login":"jianglai"}}