{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"user":{"avatar_url":"https://secure.gravatar.com/avatar/557c5800a4e85ee8ce1d94f8dde27dca?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"557c5800a4e85ee8ce1d94f8dde27dca","url":"https://api.github.com/users/ddosia","login":"ddosia","id":380622},"milestone":null,"assignee":null,"labels":[],"updated_at":"2011-11-03T15:05:45Z","comments":1,"closed_at":null,"url":"https://api.github.com/repos/devinus/poolboy/issues/5","body":"Hello, I have some troubles with workers termination. I successfully implemented worker, establish connection to my DB, all works fine.\r\nProblem starts when you try to do application:terminate(myapp).\r\nTerminate function in worker process begins to execute, but not ends. You can try to simulate it with such code:\r\n\r\n```erlang\r\nterminate(_Reason, #state{conn=Conn}) ->\r\n    io:format(\"BEFORE DISCONNECT ~n\"),\r\n    % in all top supervisor i got 5000 timeout value\r\n    timer:sleep(2000),\r\n    io:format(\"AFTER DISCONNECT ~n\"),\r\n    ok. \r\n\r\n1> application:stop(myapp).\r\nBEFORE DISCONNECT\r\nok\r\n```\r\n\r\nSorry, i am Erlang novice, but afaik from supervisor docs:\r\n\r\n> Important note on simple-one-for-one supervisors: The dynamically created child processes of a simple-one-for-one supervisor are not  explic‐\r\n> itly  killed,  regardless of shutdown strategy, but are expected to terminate when the supervisor does (that is, when an exit signal from the\r\n> parent process is received).\r\n\r\n\r\nMaybe this is the reason of such behaviour?\r\nIf it helps, my worker spawn new process, which talk with DB, and that new process begins monitor his parent. During applicaion:stop process\r\nit got such message: {'DOWN',#Ref&lt;0.0.0.146&gt;,process,&lt;0.102.0&gt;,killed}.","html_url":"https://github.com/devinus/poolboy/issues/5","title":"incorrect workers termination","number":5,"id":2129384,"created_at":"2011-11-03T04:51:38Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/1cefc90b780fb97ddb4a6aa5928ca77d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"1cefc90b780fb97ddb4a6aa5928ca77d","url":"https://api.github.com/users/devinus","login":"devinus","id":4836},"updated_at":"2011-11-03T15:05:44Z","url":"https://api.github.com/repos/devinus/poolboy/issues/comments/2618051","body":"This is because the supervisor timeout strategy is brutal_kill. Maybe this needs to be a timeout instead.","id":2618051,"created_at":"2011-11-03T15:05:44Z"}}