{"action":"created","issue":{"url":"https://api.github.com/repos/awslabs/amazon-kinesis-producer/issues/14","labels_url":"https://api.github.com/repos/awslabs/amazon-kinesis-producer/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/awslabs/amazon-kinesis-producer/issues/14/comments","events_url":"https://api.github.com/repos/awslabs/amazon-kinesis-producer/issues/14/events","html_url":"https://github.com/awslabs/amazon-kinesis-producer/issues/14","id":97392581,"number":14,"title":"Orphaned kinesis_producer native processes go berserk!","user":{"login":"samcday","id":531550,"avatar_url":"https://avatars.githubusercontent.com/u/531550?v=3","gravatar_id":"","url":"https://api.github.com/users/samcday","html_url":"https://github.com/samcday","followers_url":"https://api.github.com/users/samcday/followers","following_url":"https://api.github.com/users/samcday/following{/other_user}","gists_url":"https://api.github.com/users/samcday/gists{/gist_id}","starred_url":"https://api.github.com/users/samcday/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samcday/subscriptions","organizations_url":"https://api.github.com/users/samcday/orgs","repos_url":"https://api.github.com/users/samcday/repos","events_url":"https://api.github.com/users/samcday/events{/privacy}","received_events_url":"https://api.github.com/users/samcday/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-27T05:56:16Z","updated_at":"2015-07-27T07:55:07Z","closed_at":null,"body":"I'm not quite sure how to reproduce this, but I've had it happen on my local laptop for testing and also on a few boxes that I deployed a service to that uses KPL.\r\n\r\nAnyway, if you somehow managed to kill the parent KPL process and not the native `kinesis_producer` binary, it sits around indefinitely and seems to go into a busy-wait spin. It starts chewing up basically a whole CPU doing nothing in particular.\r\n\r\nI think it should be more robust than that right? Is it possible to detect that the IPC pipe is dead and just exit gracefully or something?"},"comment":{"url":"https://api.github.com/repos/awslabs/amazon-kinesis-producer/issues/comments/125114892","html_url":"https://github.com/awslabs/amazon-kinesis-producer/issues/14#issuecomment-125114892","issue_url":"https://api.github.com/repos/awslabs/amazon-kinesis-producer/issues/14","id":125114892,"user":{"login":"samcday","id":531550,"avatar_url":"https://avatars.githubusercontent.com/u/531550?v=3","gravatar_id":"","url":"https://api.github.com/users/samcday","html_url":"https://github.com/samcday","followers_url":"https://api.github.com/users/samcday/followers","following_url":"https://api.github.com/users/samcday/following{/other_user}","gists_url":"https://api.github.com/users/samcday/gists{/gist_id}","starred_url":"https://api.github.com/users/samcday/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samcday/subscriptions","organizations_url":"https://api.github.com/users/samcday/orgs","repos_url":"https://api.github.com/users/samcday/repos","events_url":"https://api.github.com/users/samcday/events{/privacy}","received_events_url":"https://api.github.com/users/samcday/received_events","type":"User","site_admin":false},"created_at":"2015-07-27T07:55:07Z","updated_at":"2015-07-27T07:55:07Z","body":"Okay, I did a bit more digging and found out what's going on.\r\n\r\nBackground: I have plumbed the KPL (awesome library, btw!) into a Logstash output plugin for writing log events to Kinesis. Anyway, the packaging for Logstash on Ubuntu comes with an init.d script that has a really aggressive shutdown mode. What it will do is wait a few seconds for Logstash to exit gracefully, and if it doesn't, send a `SIGKILL` to the process.\r\n\r\nThe `SIGKILL` immediately kills Logstash, but then orphans the kinesis_producer process KPL spawned. In my particular case, I'm gonna go ahead and disable that behaviour in the Logstash init script since that's awful, but I think this issue is still valid and this is still an issue.\r\n\r\nI hate to be that guy, but I found this [useful Stack Overflow article I think is relevant](https://stackoverflow.com/questions/284325/how-to-make-child-process-die-after-parent-exits). :P Anyway, I think KPL should basically do something like `prctl(PR_SET_PDEATHSIG, SIGHUP);` and then ensure it exits gracefully on `SIGHUP`. No idea what to do on Windows / BSD though, but I'm sure you guys are a lot more knowledgable on that sort of stuff than I am ;)"}}