Giter VIP home page Giter VIP logo

Comments (4)

NathanFreeman avatar NathanFreeman commented on August 29, 2024

strace -p 进程id 看看进程当前在做什么

from swoole-src.

CodeKirin-dragon avatar CodeKirin-dragon commented on August 29, 2024

strace -p 进程id 看看进程当前在做什么

openat(AT_FDCWD, "/proc/1077/stat", O_RDONLY) = 412
read(412, "1077 (redis-server) R 1 1077 107"..., 4096) = 363
close(412)                              = 0
wait4(-1, 0x7ffc10b51654, WNOHANG, NULL) = 0
write(111, "*2\r\n$6\r\n103974\r\n*0\r\n", 20) = 20
write(136, "$11\r\nd:48657820;\r\n", 18) = 18
write(393, "*2\r\n$5\r\n29060\r\n*0\r\n", 19) = 19
epoll_wait(5, [{EPOLLIN, {u32=239, u64=239}}, {EPOLLIN, {u32=173, u64=173}}], 10128, 100) = 2
read(239, "*6\r\n$4\r\nSCAN\r\n$6\r\n151011\r\n$5\r\nCO"..., 16384) = 124
read(173, "*6\r\n$4\r\nSCAN\r\n$6\r\n103974\r\n$5\r\nCO"..., 16384) = 124
write(173, "*2\r\n$5\r\n67233\r\n*0\r\n", 19) = 19
write(239, "*2\r\n$6\r\n195735\r\n*0\r\n", 20) = 20
epoll_wait(5, [{EPOLLIN, {u32=243, u64=243}}, {EPOLLIN, {u32=382, u64=382}}, {EPOLLIN, {u32=395, u64=395}}], 10128, 77) = 3
read(243, "*6\r\n$4\r\nSCAN\r\n$5\r\n29060\r\n$5\r\nCOU"..., 16384) = 123
read(382, "*6\r\n$4\r\nSCAN\r\n$5\r\n67233\r\n$5\r\nCOU"..., 16384) = 123
read(395, "*6\r\n$4\r\nSCAN\r\n$6\r\n195735\r\n$5\r\nCO"..., 16384) = 124
write(395, "*2\r\n$1\r\n0\r\n*0\r\n", 15) = 15
write(382, "*2\r\n$6\r\n207461\r\n*0\r\n", 20) = 20
write(243, "*2\r\n$6\r\n233666\r\n*0\r\n", 20) = 20
epoll_wait(5, [{EPOLLIN, {u32=199, u64=199}}], 10128, 47) = 1
read(199, "*2\r\n$3\r\nDEL\r\n$47\r\ncache.file.inf"..., 16384) = 67
write(199, ":0\r\n", 4)                 = 4
epoll_wait(5, [{EPOLLIN, {u32=190, u64=190}}, {EPOLLIN, {u32=384, u64=384}}], 10128, 47) = 2
read(190, "*6\r\n$4\r\nSCAN\r\n$6\r\n207461\r\n$5\r\nCO"..., 16384) = 124
read(384, "*6\r\n$4\r\nSCAN\r\n$6\r\n233666\r\n$5\r\nCO"..., 16384) = 124
write(384, "*2\r\n$6\r\n103974\r\n*0\r\n", 20) = 20
write(190, "*2\r\n$6\r\n151011\r\n*0\r\n", 20) = 20
epoll_wait(5, [{EPOLLIN, {u32=204, u64=204}}, {EPOLLIN, {u32=240, u64=240}}], 10128, 31) = 2
read(204, "*2\r\n$6\r\nEXISTS\r\n$56\r\nswoole.prox"..., 16384) = 79
read(240, "*6\r\n$4\r\nSCAN\r\n$6\r\n103974\r\n$5\r\nCO"..., 16384) = 124
write(240, "*2\r\n$5\r\n67233\r\n*0\r\n", 19) = 19
write(204, ":0\r\n", 4)                 = 4
epoll_wait(5, [{EPOLLIN, {u32=355, u64=355}}, {EPOLLIN, {u32=393, u64=393}}], 10128, 23) = 2
read(355, "*6\r\n$4\r\nSCAN\r\n$6\r\n151011\r\n$5\r\nCO"..., 16384) = 124
read(393, "*6\r\n$4\r\nSCAN\r\n$5\r\n67233\r\n$5\r\nCOU"..., 16384) = 123
getpid()                                = 1077
openat(AT_FDCWD, "/proc/1077/stat", O_RDONLY) = 412
read(412, "1077 (redis-server) R 1 1077 107"..., 4096) = 362
close(412)                              = 0
wait4(-1, 0x7ffc10b51654, WNOHANG, NULL) = 0
write(393, "*2\r\n$6\r\n207461\r\n*0\r\n", 20) = 20
write(355, "*2\r\n$6\r\n195735\r\n*0\r\n", 20) = 20
epoll_wait(5, [{EPOLLIN, {u32=27, u64=27}}, {EPOLLIN, {u32=419, u64=419}}, {EPOLLIN, {u32=175, u64=175}}], 10128, 100) = 3
read(27, "*6\r\n$4\r\nSCAN\r\n$1\r\n0\r\n$5\r\nCOUNT\r\n"..., 16384) = 119
read(419, "*2\r\n$3\r\nGET\r\n$36\r\ncache.system.n"..., 16384) = 56
read(175, "*2\r\n$3\r\nGET\r\n$31\r\ncache.system.n"..., 16384) = 51
write(175, "$11\r\nd:48657820;\r\n", 18) = 18
write(419, "$23\r\ns:15:\"181497319767611\";\r\n", 30) = 30
write(27, "*2\r\n$5\r\n29060\r\n*0\r\n", 19) = 19
epoll_wait(5, [{EPOLLIN, {u32=243, u64=243}}, {EPOLLIN, {u32=383, u64=383}}], 10128, 89) = 2
read(243, "*6\r\n$4\r\nSCAN\r\n$6\r\n207461\r\n$5\r\nCO"..., 16384) = 124
read(383, "*6\r\n$4\r\nSCAN\r\n$6\r\n195735\r\n$5\r\nCO"..., 16384) = 124
write(383, "*2\r\n$1\r\n0\r\n*0\r\n", 15) = 15
write(243, "*2\r\n$6\r\n151011\r\n*0\r\n", 20) = 20
epoll_wait(5, [{EPOLLIN, {u32=156, u64=156}}, {EPOLLIN, {u32=884, u64=884}}], 10128, 70) = 2
read(156, "*6\r\n$4\r\nSCAN\r\n$5\r\n29060\r\n$5\r\nCOU"..., 16384) = 123
read(884, "*4\r\n$5\r\nSETEX\r\n$31\r\ncache.system"..., 16384) = 83
write(884, "+OK\r\n", 5)                = 5
write(156, "*2\r\n$6\r\n233666\r\n*0\r\n", 20) = 20
epoll_wait(5, [{EPOLLIN, {u32=111, u64=111}}, {EPOLLIN, {u32=384, u64=384}}, {EPOLLIN, {u32=410, u64=410}}], 10128, 59) = 3
read(111, "*2\r\n$3\r\nDEL\r\n$47\r\ncache.file.inf"..., 16384) = 67
read(384, "*6\r\n$4\r\nSCAN\r\n$6\r\n151011\r\n$5\r\nCO"..., 16384) = 124
read(410, "*4\r\n$5\r\nSETEX\r\n$36\r\ncache.system"..., 16384) = 100
write(410, "+OK\r\n", 5)                = 5
write(384, "*2\r\n$6\r\n195735\r\n*0\r\n", 20) = 20
write(111, ":0\r\n", 4)                 = 4
epoll_wait(5, [{EPOLLIN, {u32=349, u64=349}}], 10128, 47) = 1
read(349, "*6\r\n$4\r\nSCAN\r\n$6\r\n233666\r\n$5\r\nCO"..., 16384) = 124
^Cstrace: Process 1077 detached

感谢大佬的回复,一直持续输出这东西看情况是好像是业务上某个定时任务,好像一直循环操作redis,我应该知道问题所在了,请问大佬这个可以排查到具体代码吗?虽然这个输入也可以排查但是用到相同的key很多,排查起来比较慢。

from swoole-src.

NathanFreeman avatar NathanFreeman commented on August 29, 2024

看起来Swoole\Crorutine\Socket::recvAll()每次只使用一个长度为1的缓冲区去获取数据,每次就获取1字节的数据

from swoole-src.

matyhtf avatar matyhtf commented on August 29, 2024

类似的问题,可以使用 strace、gdb(zbacktrace)、perf 等工具进行跟踪调试

php-src 和 swoole-src 提供的 gdbinit 脚本,里面有很多工具可以查看相关的信息

from swoole-src.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.