gpt4 book ai didi

python - strace:没有 的连续 系统调用是什么意思?

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:41:24 28 4
gpt4 key购买 nike

我正在尝试使用 strace -tt -f 调试用 Python 编写的多线程网络服务器,并且 strace 输出让我感到困惑,因为似乎有多个连续的系统调用 <unfinished...>在同一个线程上,之后没有观察到恢复:

9675  22:58:28.407844 <... recvfrom resumed> "\22RT\21Q\0\n", 7, 0, NULL, NULL) = 7
9675 22:58:28.518079 recvfrom(3, "\22RV\21Q\3\n", 7, 0, NULL, NULL) = 7
9675 22:58:28.518672 sendto(7, "\0\0\0\6\0\22RV\21Q\0\n", 12, 0, NULL, 0) = 12
9675 22:58:28.536676 poll([{fd=7, events=POLLIN|POLLPRI}], 1, 0 <unfinished ...>
9675 22:58:28.536739 <... poll resumed> ) = 1 ([{fd=7, revents=POLLIN}])
9675 22:58:28.538515 recvfrom(7, <unfinished ...>
9675 22:58:28.539400 recvfrom(7, <unfinished ...>
9675 22:58:28.539768 sendto(7, "\0\0\0\6\0\22RW\21Q\0\n", 12, 0, NULL, 0 <unfinished ...>
9675 22:58:28.540629 poll([{fd=7, events=POLLIN|POLLPRI}], 1, 0 <unfinished ...>
9675 22:58:28.540666 <... poll resumed> ) = 1 ([{fd=7, revents=POLLIN|POLLERR|POLLHUP}])
9675 22:58:28.541170 recvfrom(7, <unfinished ...>
9675 22:58:28.542603 recvfrom(7, <unfinished ...>
9675 22:58:28.543449 shutdown(7, SHUT_RDWR <unfinished ...>
9675 22:58:28.544451 close(7 <unfinished ...>
9656 22:58:28.555189 accept4(5, {sa_family=AF_INET, sin_port=htons(38282), sin_addr=inet_addr("127.0.0.1")}, [16], SOCK_CLOEXEC) = 7
9656 22:58:28.555288 ioctl(7, FIONBIO, [0]) = 0
9656 22:58:28.555338 ioctl(7, FIONBIO, [0]) = 0
9656 22:58:28.555749 getpeername(7, {sa_family=AF_INET, sin_port=htons(38282), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
9656 22:58:28.555810 getsockname(7, {sa_family=AF_INET, sin_port=htons(6000), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
9656 22:58:28.555929 getpeername(7, {sa_family=AF_INET, sin_port=htons(38282), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
9675 22:58:28.560799 sendto(7, "\0\0\0\10\0\22QP\21R\21Q\2\n", 14, 0, NULL, 0) = 14

最佳答案

根据@OznOg的建议,是多线程应用程序运行速度过快导致strace掉了一些结果。

作为更好的选择,我切换到更快的 perf trace ./app 并且问题得到解决。请注意,如果您看到 perf trace 提示 ignored trace,您可以通过 sudo sh -c "echo 1032 >/proc/sys/kernel 简单地增加事件缓冲区大小/perf_event_mlock_kb"

关于python - strace:没有 <resumed> 的连续 <unfinished...> 系统调用是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53039828/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com