Page MenuHomePhabricator

possibility to strace one's own jobs on tool labs
Closed, DuplicatePublic

Description

Sometimes I get jobs (that usually work) stuck on grid for idk-reasons (eg. process 27791 /usr/bin/python2.7 /data/project/yifeibot/pywikibot/com_info_parserror.py on tools-exec-1210). One way to know what the job is doing is by stracing the job. But attaching fails:

tools.yifeibot@tools-exec-1210:~$ ps ux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
51201    26925  0.0  0.0 113280  1872 ?        S    14:32   0:00 sshd: tools.yifeibot@pts/3
51201    26926  0.0  0.0  43036  5636 pts/3    Ss   14:32   0:00 -bash
51201    27791  0.0  0.3 169568 32632 ?        Ss   Aug01  13:44 /usr/bin/python2.7 /data/project/yifeibot/pywikibot/com_info_parserror.py
51201    27836  0.0  0.0      0     0 ?        Z    Aug01   0:00 [git] <defunct>
51201    30385  0.0  0.0  36696  1104 pts/3    R+   14:44   0:00 ps ux
tools.yifeibot@tools-exec-1210:~$ strace -p 27791
attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted
Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
tools.yifeibot@tools-exec-1210:~$ cat /proc/sys/kernel/yama/ptrace_scope
1
tools.yifeibot@tools-exec-1210:~$ ls -l /proc/sys/kernel/yama/ptrace_scope
-rw-r--r-- 1 root root 0 Aug 10 20:06 /proc/sys/kernel/yama/ptrace_scope
tools.yifeibot@tools-exec-1210:~$

As tool labs is a shared environment and few got root access, I'm wondering if it's better to have a user stracing one's own jobs, and not sacrificing much security (or is there some hidden magic that does this already?). It would ease some debugging, or else I must kill -INT 27791 to get the stack trace.