{"action":"created","issue":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/3737","repository_url":"https://api.github.com/repos/fish-shell/fish-shell","labels_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/3737/labels{/name}","comments_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/3737/comments","events_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/3737/events","html_url":"https://github.com/fish-shell/fish-shell/issues/3737","id":200918653,"number":3737,"title":"external commands launched from a function may not be killed when fish receives a SIGHUP","user":{"login":"krader1961","id":7545917,"avatar_url":"https://avatars.githubusercontent.com/u/7545917?v=3","gravatar_id":"","url":"https://api.github.com/users/krader1961","html_url":"https://github.com/krader1961","followers_url":"https://api.github.com/users/krader1961/followers","following_url":"https://api.github.com/users/krader1961/following{/other_user}","gists_url":"https://api.github.com/users/krader1961/gists{/gist_id}","starred_url":"https://api.github.com/users/krader1961/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krader1961/subscriptions","organizations_url":"https://api.github.com/users/krader1961/orgs","repos_url":"https://api.github.com/users/krader1961/repos","events_url":"https://api.github.com/users/krader1961/events{/privacy}","received_events_url":"https://api.github.com/users/krader1961/received_events","type":"User","site_admin":false},"labels":[{"id":4724776,"url":"https://api.github.com/repos/fish-shell/fish-shell/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":{"login":"krader1961","id":7545917,"avatar_url":"https://avatars.githubusercontent.com/u/7545917?v=3","gravatar_id":"","url":"https://api.github.com/users/krader1961","html_url":"https://github.com/krader1961","followers_url":"https://api.github.com/users/krader1961/followers","following_url":"https://api.github.com/users/krader1961/following{/other_user}","gists_url":"https://api.github.com/users/krader1961/gists{/gist_id}","starred_url":"https://api.github.com/users/krader1961/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krader1961/subscriptions","organizations_url":"https://api.github.com/users/krader1961/orgs","repos_url":"https://api.github.com/users/krader1961/repos","events_url":"https://api.github.com/users/krader1961/events{/privacy}","received_events_url":"https://api.github.com/users/krader1961/received_events","type":"User","site_admin":false},"assignees":[{"login":"krader1961","id":7545917,"avatar_url":"https://avatars.githubusercontent.com/u/7545917?v=3","gravatar_id":"","url":"https://api.github.com/users/krader1961","html_url":"https://github.com/krader1961","followers_url":"https://api.github.com/users/krader1961/followers","following_url":"https://api.github.com/users/krader1961/following{/other_user}","gists_url":"https://api.github.com/users/krader1961/gists{/gist_id}","starred_url":"https://api.github.com/users/krader1961/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krader1961/subscriptions","organizations_url":"https://api.github.com/users/krader1961/orgs","repos_url":"https://api.github.com/users/krader1961/repos","events_url":"https://api.github.com/users/krader1961/events{/privacy}","received_events_url":"https://api.github.com/users/krader1961/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/fish-shell/fish-shell/milestones/4","html_url":"https://github.com/fish-shell/fish-shell/milestone/4","labels_url":"https://api.github.com/repos/fish-shell/fish-shell/milestones/4/labels","id":130257,"number":4,"title":"fish-future","description":"These are issues that are not targeted for an upcoming minor or major release. After a release, we will re-examine these issues and pull any in that we think are good targets; that is retarget them to the next minor (or major) release.\r\n\r\nIf you can provide a fix for an issue in this milestone, we'll generally accept it for the next release even if the issue is not targeted for the release.","creator":{"login":"ridiculousfish","id":920838,"avatar_url":"https://avatars.githubusercontent.com/u/920838?v=3","gravatar_id":"","url":"https://api.github.com/users/ridiculousfish","html_url":"https://github.com/ridiculousfish","followers_url":"https://api.github.com/users/ridiculousfish/followers","following_url":"https://api.github.com/users/ridiculousfish/following{/other_user}","gists_url":"https://api.github.com/users/ridiculousfish/gists{/gist_id}","starred_url":"https://api.github.com/users/ridiculousfish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ridiculousfish/subscriptions","organizations_url":"https://api.github.com/users/ridiculousfish/orgs","repos_url":"https://api.github.com/users/ridiculousfish/repos","events_url":"https://api.github.com/users/ridiculousfish/events{/privacy}","received_events_url":"https://api.github.com/users/ridiculousfish/received_events","type":"User","site_admin":false},"open_issues":383,"closed_issues":1,"state":"open","created_at":"2012-06-11T02:25:13Z","updated_at":"2017-01-16T02:34:20Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2017-01-16T02:34:20Z","updated_at":"2017-01-16T10:49:39Z","closed_at":null,"body":"This issue is derived from issue #3644. The core complaint is that programs like `ranger` and `fzf` may not be killed if launched from a function if fish dies because it's controlling tty becomes invalid.\r\n\r\nNotably, @Ambrevar, reports that when he attempt to kill the xterm that fails with fish writing this to the terminal:\r\n\r\n```\r\n> sh\r\nThere are still jobs active (use the jobs command to see them).\r\nA second attempt to exit will terminate them.\r\ntest: Missing argument at index 2\r\n> exit\r\n<E> fish: More than one job in foreground: job 1: “test (id -u) -eq 0” job 2: “id -u”\r\n<E> fish: Errors detected, shutting down. Break on sanity_lose() to debug.\r\n<E> fish: More than one job in foreground: job 1: “id -u” job 2: “sh”\r\n<E> fish: Errors detected, shutting down. Break on sanity_lose() to debug.\r\n```\r\n\r\nNote that @Ambrevar is doing `exec fish` from their *~/.bashrc* rather than make fish their login shell. Recent PR #3658 might be relevant but note that change was made several days after issue #3644 was opened.\r\n\r\n<strike>One known problem that is that `show_stacktrace()` cannot be used safely on the child side of a `fork()`. And we have at least one stack trace showing it being called in that situation (see the final comments on issue #3644). That should be fixed. That isn't going to be the root cause of this issue but is a contributing factor that at least makes it harder to debug.</strike>\r\n\r\nIt turns out my previous paragraph was in error. The `show_stacktrace()` call in question was made in the parent process which should be okay. That appears to be another manifestation of the glibc stdio bug when the fd is returning EIO."},"comment":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/comments/272829574","html_url":"https://github.com/fish-shell/fish-shell/issues/3737#issuecomment-272829574","issue_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/3737","id":272829574,"user":{"login":"Ambrevar","id":1489143,"avatar_url":"https://avatars.githubusercontent.com/u/1489143?v=3","gravatar_id":"","url":"https://api.github.com/users/Ambrevar","html_url":"https://github.com/Ambrevar","followers_url":"https://api.github.com/users/Ambrevar/followers","following_url":"https://api.github.com/users/Ambrevar/following{/other_user}","gists_url":"https://api.github.com/users/Ambrevar/gists{/gist_id}","starred_url":"https://api.github.com/users/Ambrevar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ambrevar/subscriptions","organizations_url":"https://api.github.com/users/Ambrevar/orgs","repos_url":"https://api.github.com/users/Ambrevar/repos","events_url":"https://api.github.com/users/Ambrevar/events{/privacy}","received_events_url":"https://api.github.com/users/Ambrevar/received_events","type":"User","site_admin":false},"created_at":"2017-01-16T10:49:39Z","updated_at":"2017-01-16T10:49:39Z","body":"fzf just released version 0.16 (and 0.16.1) which does not require ncurses anymore, and thus does not trigger the issue.\r\n\r\nLet me repeat the requirements and steps:\r\n- Arch Linux\r\n- glibc 2.24 (stock package)\r\n- ncurses 6.0+ (stock package)\r\n- urxvt 9.22 (stock package)\r\n- ncdu 1.12 (but any ncurses application will do).\r\nRun the following function:\r\n```\r\nfunction ncdu-wrapper\r\n\tncdu\r\n\techo\r\n\techo\r\n\techo\r\n\t# ... I suppose you should add more echo if your machine is fast.\r\nend\r\n```\r\nAnd close the terminal or send SIGTERM to fish while `ncdu` is running. `ncdu` gets reparented to pid 1 and starts spinning (i.e. hogs a full CPU).\r\n\r\nI just found out that if you send SIGHUP to fish, you get the same behaviour as for xterm. So the difference between the 2 is that urxvt closes its children with SIGTERM while xterm does it with SIGHUP."}}
{"actor":{"display_login":"Ambrevar"}}