{"action":"created","issue":{"url":"https://api.github.com/repos/r-lib/callr/issues/46","repository_url":"https://api.github.com/repos/r-lib/callr","labels_url":"https://api.github.com/repos/r-lib/callr/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/r-lib/callr/issues/46/comments","events_url":"https://api.github.com/repos/r-lib/callr/issues/46/events","html_url":"https://github.com/r-lib/callr/issues/46","id":309468673,"number":46,"title":"Error in process_kill(self, private, grace) :    process_kill: Operation not permitted","user":{"login":"wch","id":86978,"avatar_url":"https://avatars3.githubusercontent.com/u/86978?v=4","gravatar_id":"","url":"https://api.github.com/users/wch","html_url":"https://github.com/wch","followers_url":"https://api.github.com/users/wch/followers","following_url":"https://api.github.com/users/wch/following{/other_user}","gists_url":"https://api.github.com/users/wch/gists{/gist_id}","starred_url":"https://api.github.com/users/wch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wch/subscriptions","organizations_url":"https://api.github.com/users/wch/orgs","repos_url":"https://api.github.com/users/wch/repos","events_url":"https://api.github.com/users/wch/events{/privacy}","received_events_url":"https://api.github.com/users/wch/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-03-28T17:55:18Z","updated_at":"2018-03-28T18:30:39Z","closed_at":"2018-03-28T18:30:02Z","author_association":"MEMBER","body":"When I run the following repeatedly:\r\n\r\n```R\r\np <- process$new('ls')\r\np$kill()\r\n```\r\n\r\nThis error occasionally comes up:\r\n\r\n```\r\n> p <- process$new('ls')\r\n> p$kill()\r\n[1] TRUE\r\n> p <- process$new('ls')\r\n> p$kill()\r\n[1] FALSE\r\n> p <- process$new('ls')\r\n> p$kill()\r\nError in process_kill(self, private, grace) : \r\n  process_kill: Operation not permitted\r\n> p <- process$new('ls')\r\n> p$kill()\r\n[1] FALSE\r\n```\r\n\r\nCould this be due to a race where the process stops after the R function `process_kill()` is called, but before the C function `callr_kill` gets to the part where it does stuff with the process?\r\n\r\n*****\r\n\r\nIn Travis logs, I also see `callr_kill: No child processes`. I haven't figured out how to reproduce it locally, but I suspect it has a similar cause.\r\n\r\n```\r\nError in process_signal(self, private, signal) : \r\n  callr_get_exit_status: No child processes\r\nCalls: <Anonymous> ... <Anonymous> -> sd_stop -> <Anonymous> -> process_signal\r\nError in process_kill(self, private, grace) : \r\n  callr_kill: No child processes\r\n```\r\n\r\nhttps://travis-ci.org/rstudio/shinytest/jobs/359462139#L3125-L3130"},"comment":{"url":"https://api.github.com/repos/r-lib/callr/issues/comments/376989521","html_url":"https://github.com/r-lib/callr/issues/46#issuecomment-376989521","issue_url":"https://api.github.com/repos/r-lib/callr/issues/46","id":376989521,"user":{"login":"gaborcsardi","id":660288,"avatar_url":"https://avatars3.githubusercontent.com/u/660288?v=4","gravatar_id":"","url":"https://api.github.com/users/gaborcsardi","html_url":"https://github.com/gaborcsardi","followers_url":"https://api.github.com/users/gaborcsardi/followers","following_url":"https://api.github.com/users/gaborcsardi/following{/other_user}","gists_url":"https://api.github.com/users/gaborcsardi/gists{/gist_id}","starred_url":"https://api.github.com/users/gaborcsardi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaborcsardi/subscriptions","organizations_url":"https://api.github.com/users/gaborcsardi/orgs","repos_url":"https://api.github.com/users/gaborcsardi/repos","events_url":"https://api.github.com/users/gaborcsardi/events{/privacy}","received_events_url":"https://api.github.com/users/gaborcsardi/received_events","type":"User","site_admin":false},"created_at":"2018-03-28T18:30:39Z","updated_at":"2018-03-28T18:30:39Z","author_association":"OWNER","body":"Please check if the fix works for you, it should, it looks  good here: \r\n```r\r\n❯ sapply(1:100, function(x) { p <- process$new(\"ls\", \"/\"); Sys.sleep(0.0015); p$kill() })\r\n  [1]  TRUE  TRUE  TRUE  TRUE FALSE  TRUE  TRUE FALSE  TRUE  TRUE FALSE  TRUE\r\n [13] FALSE FALSE FALSE  TRUE  TRUE FALSE  TRUE FALSE  TRUE  TRUE FALSE  TRUE\r\n [25] FALSE  TRUE  TRUE FALSE  TRUE FALSE  TRUE FALSE  TRUE  TRUE  TRUE FALSE\r\n [37]  TRUE  TRUE FALSE  TRUE  TRUE FALSE  TRUE FALSE  TRUE  TRUE FALSE  TRUE\r\n [49]  TRUE FALSE  TRUE FALSE  TRUE FALSE  TRUE  TRUE FALSE  TRUE  TRUE  TRUE\r\n [61]  TRUE FALSE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE FALSE  TRUE FALSE\r\n [73]  TRUE  TRUE FALSE FALSE  TRUE  TRUE FALSE FALSE  TRUE  TRUE  TRUE  TRUE\r\n [85]  TRUE FALSE FALSE  TRUE  TRUE FALSE  TRUE FALSE  TRUE  TRUE FALSE  TRUE\r\n [97] FALSE  TRUE FALSE  TRUE\r\n```"}}
{"actor":{"display_login":"gaborcsardi"}}