{"action":"opened","issue":{"url":"https://api.github.com/repos/pscedu/slash2/issues/212","labels_url":"https://api.github.com/repos/pscedu/slash2/issues/212/labels{/name}","comments_url":"https://api.github.com/repos/pscedu/slash2/issues/212/comments","events_url":"https://api.github.com/repos/pscedu/slash2/issues/212/events","html_url":"https://github.com/pscedu/slash2/issues/212","id":89859701,"number":212,"title":"msctl closes pipe prematurely causing EBADF","user":{"login":"slovichon","id":6945653,"avatar_url":"https://avatars.githubusercontent.com/u/6945653?v=3","gravatar_id":"","url":"https://api.github.com/users/slovichon","html_url":"https://github.com/slovichon","followers_url":"https://api.github.com/users/slovichon/followers","following_url":"https://api.github.com/users/slovichon/following{/other_user}","gists_url":"https://api.github.com/users/slovichon/gists{/gist_id}","starred_url":"https://api.github.com/users/slovichon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slovichon/subscriptions","organizations_url":"https://api.github.com/users/slovichon/orgs","repos_url":"https://api.github.com/users/slovichon/repos","events_url":"https://api.github.com/users/slovichon/events{/privacy}","received_events_url":"https://api.github.com/users/slovichon/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pscedu/slash2/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-21T03:48:16Z","updated_at":"2015-06-21T03:48:16Z","closed_at":null,"body":"\nOn 2012-02-03 14:23:23 -0500, Zhihui Zhang wrote:\n\n> ```\nA simple msctl command can trigger this bug:\n> \n> (gdb) show args\n> Argument list to give program being debugged when it is started is \"-R repl-status /zzh-slash2/zhihui\".\n> (gdb) \n> \n> \n> 73\t\t\tpsc_fatal(\"write\");\n> (gdb) b ctlcli.c:1111\n> Breakpoint 2 at 0x40b437: file /home/zhihui/projects-lemon/psc_fsutil_libs/psc_util/ctlcli.c, line 1111.\n> (gdb) r\n> The program being debugged has been started already.\n> Start it from the beginning? (y or n) y\n> Starting program: /home/zhihui/projects-lemon/slash_nara/msctl/msctl -R repl-status /zzh-slash2/zhihui\n> [Thread debugging using libthread_db enabled]\n> [New Thread 0x7ffff7fe6700 (LWP 28270)]\n> \n> Breakpoint 1, psc_ctlmsg_push (type=21, msiz=2080) at /home/zhihui/projects-lemon/psc_fsutil_libs/psc_util/ctlcli.c:92\n> 92\t{\n> (gdb) c\n> Continuing.\n> \n> Breakpoint 1, psc_ctlmsg_push (type=21, msiz=2080) at /home/zhihui/projects-lemon/psc_fsutil_libs/psc_util/ctlcli.c:92\n> 92\t{\n> (gdb) c\n> Continuing.\n> file-replication-status                                     #valid  #bmap  %prog\n> ================================================================================\n> /zzh-slash2/zhihui/                                        repl-policy: one-time\n> [Switching to Thread 0x7ffff7fe6700 (LWP 28270)]\n> \n> Breakpoint 2, psc_ctlcli_rd_main (thr=0x7ffff00008c0) at /home/zhihui/projects-lemon/psc_fsutil_libs/psc_util/ctlcli.c:1111\n> 1111\t\tclose(psc_ctl_sock);\n> (gdb) c\n> Continuing.\n> [Thread 0x7ffff7fe6700 (LWP 28270) exited]\n> [Switching to Thread 0x7ffff7fe8700 (LWP 28269)]\n> \n> Breakpoint 1, psc_ctlmsg_push (type=21, msiz=2080) at /home/zhihui/projects-lemon/psc_fsutil_libs/psc_util/ctlcli.c:92\n> 92\t{\n> (gdb) c\n> Continuing.\n> [1328292248:934990 msctlwrthr:7ffff7fe8700:def ctlcli.c psc_ctlmsg_sendlast 73] write: Bad file descriptor\n> \n> Program received signal SIGABRT, Aborted.\n> 0x000000302ea328f5 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64\n> 64\t  return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);\n> (gdb)\n```\nOn 2012-02-03 16:37:16 -0500, Zhihui Zhang wrote:\n\n> ```\nzhihui@lemon: ~/projects-lemon$ svn diff\n> Index: psc_fsutil_libs/psc_util/ctlsvr.c\n> ===================================================================\n> --- psc_fsutil_libs/psc_util/ctlsvr.c\t(revision 18691)\n> +++ psc_fsutil_libs/psc_util/ctlsvr.c\t(working copy)\n> @@ -1658,8 +1658,7 @@\n>  \t\treturn (0);\n>  \t}\n>  \tpsc_ctlthr(pscthr_get())->pct_stat.nrecv++;\n> -\tif (!ct[mh.mh_type].pc_op(fd, &mh, m))\n> -\t\treturn (EOF);\n> +\tct[mh.mh_type].pc_op(fd, &mh, m);\n>  \treturn (0);\n>  }\n>  \n> \n> EOF should be only used for socket error, I think\n```\nOn 2012-03-26 15:42:14 -0400, Jared Yanovich wrote:\n\n> ```\n18942\n```\n"}}