{"action":"created","issue":{"url":"https://api.github.com/repos/libuv/libuv/issues/1226","repository_url":"https://api.github.com/repos/libuv/libuv","labels_url":"https://api.github.com/repos/libuv/libuv/issues/1226/labels{/name}","comments_url":"https://api.github.com/repos/libuv/libuv/issues/1226/comments","events_url":"https://api.github.com/repos/libuv/libuv/issues/1226/events","html_url":"https://github.com/libuv/libuv/issues/1226","id":207706730,"number":1226,"title":"[os x] killing freshly started processes is unreliable","user":{"login":"bnoordhuis","id":275871,"avatar_url":"https://avatars.githubusercontent.com/u/275871?v=3","gravatar_id":"","url":"https://api.github.com/users/bnoordhuis","html_url":"https://github.com/bnoordhuis","followers_url":"https://api.github.com/users/bnoordhuis/followers","following_url":"https://api.github.com/users/bnoordhuis/following{/other_user}","gists_url":"https://api.github.com/users/bnoordhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/bnoordhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnoordhuis/subscriptions","organizations_url":"https://api.github.com/users/bnoordhuis/orgs","repos_url":"https://api.github.com/users/bnoordhuis/repos","events_url":"https://api.github.com/users/bnoordhuis/events{/privacy}","received_events_url":"https://api.github.com/users/bnoordhuis/received_events","type":"User","site_admin":false},"labels":[{"id":207759567,"url":"https://api.github.com/repos/libuv/libuv/labels/os%20x","name":"os x","color":"e98eae","default":false},{"id":209037116,"url":"https://api.github.com/repos/libuv/libuv/labels/test","name":"test","color":"bfdadc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-02-15T04:39:47Z","updated_at":"2017-02-27T07:22:07Z","closed_at":null,"body":"Sending a SIGTERM to a process that is still starting up kills it with SIGKILL on my OS X machine, not SIGTERM.  It's making the `kill` test fail reliably for me locally.\r\n\r\nDemonstrated with this patch:\r\n```diff\r\ndiff --git a/test/test-spawn.c b/test/test-spawn.c\r\nindex 53a0369..6676101 100644\r\n--- a/test/test-spawn.c\r\n+++ b/test/test-spawn.c\r\n@@ -90,6 +90,8 @@ static void kill_cb(uv_process_t* process,\r\n #else\r\n   ASSERT(exit_status == 0);\r\n #endif\r\n+  printf(\"no_term_signal=%d term_signal=%d exit_status=%d\\n\",\r\n+         no_term_signal, term_signal, (int) exit_status);\r\n   ASSERT(no_term_signal || term_signal == 15);\r\n   uv_close((uv_handle_t*)process, close_cb);\r\n \r\n```\r\nWhen you run the test:\r\n```\r\n$ uname -a\r\nDarwin hermes.local 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64\r\n\r\n$ out/Debug/run-tests kill\r\nnot ok 1 - kill\r\n# exit code 6\r\n# Output from process `kill`:\r\n# exit_cb\r\n# no_term_signal=0 term_signal=9 exit_status=0\r\n# Assertion failed in ../test/test-spawn.c on line 95: no_term_signal || term_signal == 15\r\n```\r\nAdding a small delay avoids it:\r\n```diff\r\ndiff --git a/test/test-spawn.c b/test/test-spawn.c\r\nindex 53a0369..6676101 100644\r\n--- a/test/test-spawn.c\r\n+++ b/test/test-spawn.c\r\n@@ -920,6 +922,7 @@ TEST_IMPL(kill) {\r\n \r\n   r = uv_spawn(uv_default_loop(), &process, &options);\r\n   ASSERT(r == 0);\r\n+  usleep(1000);\r\n \r\n   /* Sending signum == 0 should check if the\r\n    * child process is still alive, not kill it.\r\n```\r\nInterestingly, sending a different signal works okay too (SIGINT here but e.g. SIGQUIT works too):\r\n```diff\r\ndiff --git a/test/test-spawn.c b/test/test-spawn.c\r\nindex 53a0369..33467f6 100644\r\n--- a/test/test-spawn.c\r\n+++ b/test/test-spawn.c\r\n@@ -90,7 +90,7 @@ static void kill_cb(uv_process_t* process,\r\n #else\r\n   ASSERT(exit_status == 0);\r\n #endif\r\n-  ASSERT(no_term_signal || term_signal == 15);\r\n+  ASSERT(no_term_signal || term_signal == 15 || term_signal == SIGINT);\r\n   uv_close((uv_handle_t*)process, close_cb);\r\n \r\n   /*\r\n@@ -930,7 +930,7 @@ TEST_IMPL(kill) {\r\n   ASSERT(r == 0);\r\n \r\n   /* Kill the process. */\r\n-  r = uv_kill(process.pid, /* SIGTERM */ 15);\r\n+  r = uv_kill(process.pid, SIGINT);\r\n   ASSERT(r == 0);\r\n \r\n   r = uv_run(uv_default_loop(), UV_RUN_DEFAULT);\r\n```"},"comment":{"url":"https://api.github.com/repos/libuv/libuv/issues/comments/282645947","html_url":"https://github.com/libuv/libuv/issues/1226#issuecomment-282645947","issue_url":"https://api.github.com/repos/libuv/libuv/issues/1226","id":282645947,"user":{"login":"saghul","id":317464,"avatar_url":"https://avatars.githubusercontent.com/u/317464?v=3","gravatar_id":"","url":"https://api.github.com/users/saghul","html_url":"https://github.com/saghul","followers_url":"https://api.github.com/users/saghul/followers","following_url":"https://api.github.com/users/saghul/following{/other_user}","gists_url":"https://api.github.com/users/saghul/gists{/gist_id}","starred_url":"https://api.github.com/users/saghul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saghul/subscriptions","organizations_url":"https://api.github.com/users/saghul/orgs","repos_url":"https://api.github.com/users/saghul/repos","events_url":"https://api.github.com/users/saghul/events{/privacy}","received_events_url":"https://api.github.com/users/saghul/received_events","type":"User","site_admin":false},"created_at":"2017-02-27T07:22:07Z","updated_at":"2017-02-27T07:22:07Z","body":"> What about allowing SIGKILL as an acceptable signal only for OS X with an explaining comment?\r\n\r\nSGTM."}}
{"actor":{"display_login":"saghul"}}