opendir/readdir 挂在 futex 上

发布于 2025-01-16 18:42:06 字数 796 浏览 1 评论 0原文

我有一个程序已经运行良好几个月了,在向高层展示前两天,它只是在开始时挂起,同时探索文件结构。这是一个回溯:

#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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文