{"action":"created","issue":{"url":"https://api.github.com/repos/grobian/carbon-c-relay/issues/132","labels_url":"https://api.github.com/repos/grobian/carbon-c-relay/issues/132/labels{/name}","comments_url":"https://api.github.com/repos/grobian/carbon-c-relay/issues/132/comments","events_url":"https://api.github.com/repos/grobian/carbon-c-relay/issues/132/events","html_url":"https://github.com/grobian/carbon-c-relay/issues/132","id":123260545,"number":132,"title":"kill -HUP crash carbon-c-relay 1.3 with a glibc double free","user":{"login":"sbarrier","id":4797999,"avatar_url":"https://avatars.githubusercontent.com/u/4797999?v=3","gravatar_id":"","url":"https://api.github.com/users/sbarrier","html_url":"https://github.com/sbarrier","followers_url":"https://api.github.com/users/sbarrier/followers","following_url":"https://api.github.com/users/sbarrier/following{/other_user}","gists_url":"https://api.github.com/users/sbarrier/gists{/gist_id}","starred_url":"https://api.github.com/users/sbarrier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbarrier/subscriptions","organizations_url":"https://api.github.com/users/sbarrier/orgs","repos_url":"https://api.github.com/users/sbarrier/repos","events_url":"https://api.github.com/users/sbarrier/events{/privacy}","received_events_url":"https://api.github.com/users/sbarrier/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-21T11:30:43Z","updated_at":"2015-12-24T10:33:24Z","closed_at":null,"body":"In /etc/logrotate.d/carbon-c-relay the postrotate do a kill -HUP to rehash daemon after the log rotation\r\n`[ ! -f /var/run/carbon-c-relay/carbon-c-relay.pid ] || /bin/kill -HUP $(cat /var/run/carbon-c-relay/carbon-c-relay.pid)`\r\n\r\nThis crash carbon-c-relay with a double free:\r\n\r\n[2015-12-21 00:48:25] (MSG) caught SIGHUP...\r\n[2015-12-21 00:48:25] (MSG) closing logfile\r\n[2015-12-21 00:48:25] (MSG) reopening logfile\r\n[2015-12-21 00:48:25] (MSG) reloading config from '/etc/carbon-c-relay.conf'...\r\n[2015-12-21 00:48:25] (MSG) reloading worker 2 3 4 5 6 7 8 9\r\n[2015-12-21 00:48:26] (MSG) reloading collector\r\n*** glibc detected *** /usr/bin/carbon-c-relay: double free or corruption (!prev): 0x0000000001e4ebd0 ***\r\n\r\nDistribution Centos 6.x 64 bits, configuration used :\r\n\r\n**/etc/carbon-c-relay.conf**\r\ncluster graphite\r\n  carbon_ch\r\n    127.0.0.1:2013=a\r\n    127.0.0.1:2023=b\r\n    127.0.0.1:2033=c\r\n    127.0.0.1:2043=d\r\n  ;\r\nmatch *\r\n  send to graphite\r\n  stop\r\n  ;\r\n\r\n**/etc/sysconfig/carbon-c-relay**\r\nARGS=\"-p 2003 -w 8 -i 192.168.0.100 -m -b 2500 -q 25000 -l /var/log/carbon-c-relay/carbon-c-relay.log\"\r\n\r\nAfter few hours of debug, this is a proposal patch for this issue :\r\n\r\n```c\r\n--- a/consistent-hash.c 2015-12-21 05:48:24.000000000 -0500\r\n+++ b/consistent-hash.c 2015-12-21 05:54:58.000000000 -0500\r\n@@ -478,9 +478,9 @@\r\n \r\n        for (; ring->entries != NULL; ring->entries = ring->entries->next) {\r\n                server_shutdown(ring->entries->server);\r\n-               free(ring->entries->server);\r\n-\r\n+\r\n                if (ring->entries->malloced) {\r\n+                       free(ring->entries->server);   \r\n                        if (deletes == NULL) {\r\n                                w = deletes = ring->entries;\r\n                        } else {\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/grobian/carbon-c-relay/issues/comments/167087432","html_url":"https://github.com/grobian/carbon-c-relay/issues/132#issuecomment-167087432","issue_url":"https://api.github.com/repos/grobian/carbon-c-relay/issues/132","id":167087432,"user":{"login":"grobian","id":667105,"avatar_url":"https://avatars.githubusercontent.com/u/667105?v=3","gravatar_id":"","url":"https://api.github.com/users/grobian","html_url":"https://github.com/grobian","followers_url":"https://api.github.com/users/grobian/followers","following_url":"https://api.github.com/users/grobian/following{/other_user}","gists_url":"https://api.github.com/users/grobian/gists{/gist_id}","starred_url":"https://api.github.com/users/grobian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grobian/subscriptions","organizations_url":"https://api.github.com/users/grobian/orgs","repos_url":"https://api.github.com/users/grobian/repos","events_url":"https://api.github.com/users/grobian/events{/privacy}","received_events_url":"https://api.github.com/users/grobian/received_events","type":"User","site_admin":false},"created_at":"2015-12-24T10:33:23Z","updated_at":"2015-12-24T10:33:23Z","body":"This was a stupidity, your fix was in the right direction, but shutting down the servers needed the same treatment.  Feedback on whether it solves the issue for you would be much appreciated.  Thanks!"}}