ziyou434 opened a new issue #3002:
URL: https://github.com/apache/apisix/issues/3002


   ### Issue description
   I want to use flamegraph analysis my plugin.
   I use perf do it, and i get the root of container. 
   ```
   UID        PID  PPID  C STIME TTY          TIME CMD
   root         1     0  0 16:07 ?        00:00:00 sh -c /usr/bin/apisix init 
&& /usr/bin/apisix init_etcd && /usr/l
   root        36     1  0 16:07 ?        00:00:00 nginx: master process 
/usr/local/openresty/bin/openresty -p /usr/
   nobody      37    36  0 16:07 ?        00:00:00 nginx: worker process
   nobody      38    36  0 16:07 ?        00:00:00 nginx: worker process
   nobody      39    36  0 16:07 ?        00:00:00 nginx: cache manager process
   root        41    36  0 16:07 ?        00:00:00 nginx: privileged agent 
process
   root        42     0  0 16:08 pts/0    00:00:00 /bin/sh -c 
TERM=xterm-256color; export TERM; [ -x /bin/bash ] && 
   root        48    42  0 16:08 pts/0    00:00:00 /bin/sh -c 
TERM=xterm-256color; export TERM; [ -x /bin/bash ] && 
   root        49    48  0 16:08 pts/0    00:00:00 /usr/bin/script -q -c 
/bin/bash /dev/null
   root        51    49  0 16:08 pts/0    00:00:00 /usr/bin/script -q -c 
/bin/bash /dev/null
   root        52    51  0 16:08 pts/1    00:00:00 /bin/bash
   root       122    52  0 16:16 pts/1    00:00:00 ps -ef
   ```
   
   ```
   [root@apisix2-6ffbbd4bff-5b2fq apisix]# perf record -F 99 -p 36 -g -- sleep 5
   [ perf record: Woken up 1 times to write data ]
   [ perf record: Captured and wrote 0.009 MB perf.data ]
   [root@apisix2-6ffbbd4bff-5b2fq apisix]# perf record -F 99 -p 37 -g -- sleep 5
   Error:
   You may not have permission to collect stats.
   
   Consider tweaking /proc/sys/kernel/perf_event_paranoid,
   which controls use of the performance events system by
   unprivileged users (without CAP_SYS_ADMIN).
   
   The current value is 2:
   
     -1: Allow use of (almost) all events by all users
         Ignore mlock limit after perf_event_mlock_kb without CAP_IPC_LOCK
   >= 0: Disallow ftrace function tracepoint by users without CAP_SYS_ADMIN
         Disallow raw tracepoint access by users without CAP_SYS_ADMIN
   >= 1: Disallow CPU event access by users without CAP_SYS_ADMIN
   >= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN
   
   To make this setting permanent, edit /etc/sysctl.conf too, e.g.:
   
           kernel.perf_event_paranoid = -1
   ```
   
   ```
   [root@apisix2-6ffbbd4bff-5b2fq apisix]# sysctl -w 
kernel.perf_event_paranoid=-1
   sysctl: setting key "kernel.perf_event_paranoid": Read-only file system
   ```
   
   I have got the root authority, why I can't perf the process whose uid is 
nobody.
   can you give me some help?
   ### Environment
   
   * apisix version (cmd: `apisix version`): 2.0
   * OS: centos
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to