程序在用户下停止但在 root 下运行

程序在用户下停止但在 root 下运行

我正在R普通用户下运行作业john,并且root.有趣的是,程序在johnuser 下停止,但在root.使用strace我找到john运行时R,进程会停止其子进程。我猜想Linux不会让子进程继续运行,而父进程(主程序)会无限停滞。普通 Linux 用户可以执行的 fork/clone 数量有限制吗?知道为什么会发生这种情况吗?

无论如何,在这里这个帖子我已经描述了我的问题的起点。

更多信息

stracefor user的最后几行john(程序停止的地方):

lseek(255, -82, SEEK_CUR)               = 1746
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fa12fd4f9d0) = 13302
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGINT, {0x43d060, [], SA_RESTORER, 0x311b432900}, {0x452250, [], SA_RESTORER, 0x311b432900}, 8) = 0
wait4(-1,  <unfinished ...>

stracefor的最后几行root(程序完全运行的地方):

lseek(255, -82, SEEK_CUR)               = 1746
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f81d8e239d0) = 13244
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGINT, {0x43d060, [], SA_RESTORER, 0x311b432900}, {0x452250, [], SA_RESTORER, 0x311b432900}, 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 13244
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
wait4(-1, 0x7fff54a591dc, WNOHANG, NULL) = -1 ECHILD (No child processes)
rt_sigreturn(0xffffffffffffffff)        = 0
rt_sigaction(SIGINT, {0x452250, [], SA_RESTORER, 0x311b432900}, {0x43d060, [], SA_RESTORER, 0x311b432900}, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
read(255, "\n### Local Variables: ***\n### mo"..., 1828) = 82
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
read(255, "", 1828)                     = 0
exit_group(1) 

答案1

用于strace -f R跟随 R它的所有子进程也是如此。这应该显示子程序挂起的确切位置。

一些额外的可能需要检查的点:

作为 root ( su - root) 和用户 john,比较以下输出:

ulimit -a  #will show all the "limits" set for that user. You may reach one of them?
set ; env  #maybe john & root don't have same PATH or some other thing changes (LD_LIBRARY_PATH? or another?)
grep $(whoami) /etc/passwd /etc/group  #see if john maybe needs to be in some group?

相关内容