{"action":"opened","issue":{"url":"https://api.github.com/repos/kr/beanstalkd/issues/328","repository_url":"https://api.github.com/repos/kr/beanstalkd","labels_url":"https://api.github.com/repos/kr/beanstalkd/issues/328/labels{/name}","comments_url":"https://api.github.com/repos/kr/beanstalkd/issues/328/comments","events_url":"https://api.github.com/repos/kr/beanstalkd/issues/328/events","html_url":"https://github.com/kr/beanstalkd/issues/328","id":168454378,"number":328,"title":"Segfault in conn.c in v1.10","user":{"login":"Roguelazer","id":263424,"avatar_url":"https://avatars.githubusercontent.com/u/263424?v=3","gravatar_id":"","url":"https://api.github.com/users/Roguelazer","html_url":"https://github.com/Roguelazer","followers_url":"https://api.github.com/users/Roguelazer/followers","following_url":"https://api.github.com/users/Roguelazer/following{/other_user}","gists_url":"https://api.github.com/users/Roguelazer/gists{/gist_id}","starred_url":"https://api.github.com/users/Roguelazer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Roguelazer/subscriptions","organizations_url":"https://api.github.com/users/Roguelazer/orgs","repos_url":"https://api.github.com/users/Roguelazer/repos","events_url":"https://api.github.com/users/Roguelazer/events{/privacy}","received_events_url":"https://api.github.com/users/Roguelazer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-30T07:15:41Z","updated_at":"2016-07-30T07:15:41Z","closed_at":null,"body":"We're seeing an extremely rare segfault in 1.10. I don't have a core, but based on the EIP at the time of segfault, the error is happening at  https://github.com/kr/beanstalkd/blob/master/conn.c#L237 (`c->use` is null, so the deref is invalid and triggers a segfault).\r\n\r\nI can't for the life of me figure out why `c->use` would be NULL. The only place it's explicitly set to NULL is on line 240, later in this same method.\r\n\r\nThis is the third time we've had beanstalkd segfault in the last year or so — it's just infrequent enough that I can't reproduce it by hammering beanstalkd with random data, but it's fairly catastrophic when it happens, so I also can't just ignore it and move on.\r\n\r\nI am contemplating adding a guard (`if (c->use)`) before line 237 in our build, but that seems like it'd just be papering over the issue. I've seen this on multiple servers and multiple compiles of beanstalkd, so I'm fairly confident that it's not a cosmic ray or anything like that.\r\n\r\nThe segfault doesn't recur when beanstalkd restarts and loads the WAL, so it's doesn't seem to be a property of the data.\r\n\r\nHere's what the logs end with:\r\n\r\n```\r\nJul 30 05:51:13 $hostname beanstalkd[21487]: prot.c:1821 in update_conns: sockwant\r\nJul 30 05:51:13 $hostname beanstalkd[21487]: Operation not permitted\r\nJul 30 05:51:13 $hostname kernel: beanstalkd[21487]: segfault at 168 ip 0000000000401fa2 sp 00007ffde368d4b0 error 6 in beanstalkd[400000+e000]\r\n```\r\n\r\nIt's all very strange."}}
{"actor":{"display_login":"Roguelazer"}}