opendir/readdir 挂在 futex 上
我有一个程序已经运行良好几个月了,在向高层展示前两天,它只是在开始时挂起,同时探索文件结构。这是一个回溯:
#0 futex_wait (private=0, expected=2, futex_word=0x55555556c204) at ../sysdeps/nptl/futex-internal.h:146
#1 __GI___lll_lock_wait_private (futex=futex@entry=0x55555556c204) at lowlevellock.c:35
#2 0x00007ffff7e30a03 in __GI___readdir64 (dirp=0x55555556c200) at ../sysdeps/unix/sysv/linux/readdir64.c:37
#3 0x000055555555be55 in N2_GetRunNumbers (RootDirName=0x7fffffffca10 "LiveData", Direct=1, RunNoList=0x7fffffffc938)
at N2readData.c:471
这是相应的代码(第 471 行是 readdir 调用):
struct dirent *dir;
DIR *d = opendir(RootDirName);
if (d)
while ((dir = readdir(d)) != NULL) { ...}
阅读有关 readdir 的文档,没有任何地方表明它可以阻塞。
现在的问题是我正在读取的目录是通过 sshfs 挂载的,但我拥有完全的读/写访问权限。那么原因可能是什么?
I have a program that has been running fine for months, and 2 days before being shown to the brass, it just hangs at the beginning, while exploring a file structure. Here's a backtrace:
#0 futex_wait (private=0, expected=2, futex_word=0x55555556c204) at ../sysdeps/nptl/futex-internal.h:146
#1 __GI___lll_lock_wait_private (futex=futex@entry=0x55555556c204) at lowlevellock.c:35
#2 0x00007ffff7e30a03 in __GI___readdir64 (dirp=0x55555556c200) at ../sysdeps/unix/sysv/linux/readdir64.c:37
#3 0x000055555555be55 in N2_GetRunNumbers (RootDirName=0x7fffffffca10 "LiveData", Direct=1, RunNoList=0x7fffffffc938)
at N2readData.c:471
And here's the corresponding code (line 471 is the readdir
call):
struct dirent *dir;
DIR *d = opendir(RootDirName);
if (d)
while ((dir = readdir(d)) != NULL) { ...}
Reading the documentation on readdir
, nowhere does it state that it can be blocking.
Now the hitch is that the directory I'm reading is mounted via sshfs, but I have full R/W access. So what could be the reason ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论