{"action":"created","issue":{"url":"https://api.github.com/repos/natsys/tempesta/issues/46","labels_url":"https://api.github.com/repos/natsys/tempesta/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/natsys/tempesta/issues/46/comments","events_url":"https://api.github.com/repos/natsys/tempesta/issues/46/events","html_url":"https://github.com/natsys/tempesta/issues/46","id":57062205,"number":46,"title":"sk->sk_destruct() is not being called when connection is closed","user":{"login":"vdmit11","id":5739502,"avatar_url":"https://avatars.githubusercontent.com/u/5739502?v=3","gravatar_id":"","url":"https://api.github.com/users/vdmit11","html_url":"https://github.com/vdmit11","followers_url":"https://api.github.com/users/vdmit11/followers","following_url":"https://api.github.com/users/vdmit11/following{/other_user}","gists_url":"https://api.github.com/users/vdmit11/gists{/gist_id}","starred_url":"https://api.github.com/users/vdmit11/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vdmit11/subscriptions","organizations_url":"https://api.github.com/users/vdmit11/orgs","repos_url":"https://api.github.com/users/vdmit11/repos","events_url":"https://api.github.com/users/vdmit11/events{/privacy}","received_events_url":"https://api.github.com/users/vdmit11/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/natsys/tempesta/labels/bug","name":"bug","color":"eb6420"},{"url":"https://api.github.com/repos/natsys/tempesta/labels/crucial","name":"crucial","color":"ff1010"}],"state":"open","locked":false,"assignee":{"login":"keshonok","id":6352580,"avatar_url":"https://avatars.githubusercontent.com/u/6352580?v=3","gravatar_id":"","url":"https://api.github.com/users/keshonok","html_url":"https://github.com/keshonok","followers_url":"https://api.github.com/users/keshonok/followers","following_url":"https://api.github.com/users/keshonok/following{/other_user}","gists_url":"https://api.github.com/users/keshonok/gists{/gist_id}","starred_url":"https://api.github.com/users/keshonok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keshonok/subscriptions","organizations_url":"https://api.github.com/users/keshonok/orgs","repos_url":"https://api.github.com/users/keshonok/repos","events_url":"https://api.github.com/users/keshonok/events{/privacy}","received_events_url":"https://api.github.com/users/keshonok/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/natsys/tempesta/milestones/2","html_url":"https://github.com/natsys/tempesta/milestones/0.4.0%20Web%20Server","labels_url":"https://api.github.com/repos/natsys/tempesta/milestones/2/labels","id":1015682,"number":2,"title":"0.4.0 Web Server","description":"","creator":{"login":"krizhanovsky","id":884694,"avatar_url":"https://avatars.githubusercontent.com/u/884694?v=3","gravatar_id":"","url":"https://api.github.com/users/krizhanovsky","html_url":"https://github.com/krizhanovsky","followers_url":"https://api.github.com/users/krizhanovsky/followers","following_url":"https://api.github.com/users/krizhanovsky/following{/other_user}","gists_url":"https://api.github.com/users/krizhanovsky/gists{/gist_id}","starred_url":"https://api.github.com/users/krizhanovsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krizhanovsky/subscriptions","organizations_url":"https://api.github.com/users/krizhanovsky/orgs","repos_url":"https://api.github.com/users/krizhanovsky/repos","events_url":"https://api.github.com/users/krizhanovsky/events{/privacy}","received_events_url":"https://api.github.com/users/krizhanovsky/received_events","type":"User","site_admin":false},"open_issues":16,"closed_issues":12,"state":"open","created_at":"2015-03-10T23:30:59Z","updated_at":"2015-06-28T21:37:16Z","due_on":"2015-07-09T21:00:00Z","closed_at":null},"comments":7,"created_at":"2015-02-09T17:28:51Z","updated_at":"2015-06-29T12:36:22Z","closed_at":null,"body":"Scenario:\r\n\r\n1. start nginx\r\n2. start Tempesta FW\r\n3. `wget http://localhost` - should pass and give you `index.html`\r\n3. stop nginx\r\n4. `wget http://locslhost` - crashes\r\n\r\nThat happens because when the connection to nginx is closed, no `sk->sk_destruct()` is called.\r\n\r\nWe put `tfw_destroy_server()` to `sk->sk_destruct()`, so when the connection is closed, the server is not deleted from the load-balancing scheduler as it should be, and you get a NULL pointer dereference when you try to acess its connection.\r\n\r\nGenerally, the problem is wider than the fact that `tfw_destroy_server()` is not invoked.\r\nOriginal socket destructor (usually `inet_release()`) is not invoked as well, so we likely have some memory leak here.\r\n\r\nA notable thing that when you call `sock_release()`, the `sk->sk_destruct()` is invoked as it should be.\r\nWe need to understand why `sk->sk_destruct()` is not invoked when a TCP connection is closed, but is invoked when you do `sock_release()`.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/natsys/tempesta/issues/comments/116640069","html_url":"https://github.com/natsys/tempesta/issues/46#issuecomment-116640069","issue_url":"https://api.github.com/repos/natsys/tempesta/issues/46","id":116640069,"user":{"login":"keshonok","id":6352580,"avatar_url":"https://avatars.githubusercontent.com/u/6352580?v=3","gravatar_id":"","url":"https://api.github.com/users/keshonok","html_url":"https://github.com/keshonok","followers_url":"https://api.github.com/users/keshonok/followers","following_url":"https://api.github.com/users/keshonok/following{/other_user}","gists_url":"https://api.github.com/users/keshonok/gists{/gist_id}","starred_url":"https://api.github.com/users/keshonok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keshonok/subscriptions","organizations_url":"https://api.github.com/users/keshonok/orgs","repos_url":"https://api.github.com/users/keshonok/repos","events_url":"https://api.github.com/users/keshonok/events{/privacy}","received_events_url":"https://api.github.com/users/keshonok/received_events","type":"User","site_admin":false},"created_at":"2015-06-29T12:36:22Z","updated_at":"2015-06-29T12:36:22Z","body":"The core issue here is a missing `sock_put()` call when client are released via direct call to `ss_do_close()`. This is completely unrelated to socket accounting warnings mentioned above."}}