什么会导致 fwrite 挂起?
我的代码使用以下堆栈挂起 fwrite:
libc.so.6.1::___lll_lock_wait
libc.so.6.1::fwrite
这似乎发生在Solaris 中。
我能想到的唯一不正确的事情是我的代码可能会尝试在用于执行 fwrite 的同一个 FILE 指针上执行并行 fclose。如果发生并行 fclose 会导致这种堆栈吗?
但是,我不确定并行 fclose 调用是否真的发生了?
这里可能有什么问题?
My code is hanging fwrite with the following stack:
libc.so.6.1::___lll_lock_wait
libc.so.6.1::fwrite
This seems to be happening in solaris.
Only incorrect thing which I can think of is that my code may try to do a parallel fclose on the same FILE pointer which is used for doing fwrite. If a parallel fclose happens will it lead to this kind of a stack?
But, I am not sure if the parallel fclose call really did happen or not?
What could be the problem here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好像某处有什么东西爆炸了。 FILE* 上的操作通常使用内部锁来保证线程安全。您可能已经做了一些事情来在某处调用未定义的行为。例如,您损坏了堆,覆盖了一些重要的内容(例如文件),或者 FILE* 已被关闭 - 在这种情况下,如果您继续使用它,您就不能依赖任何正常的情况发生。
Looks like something has blown up somewhere. Operations on FILE* normally uses an internal lock to be thread safe. You've likely done something to invoke undefned behavior somewhere. E.g. you've corrupted the heap, overwriting something important(like a FILE), or the FILE* has been closed - in which case you can't rely on anything sane to happen if you continue to use it.