views:

61

answers:

1

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?

+2  A: 

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.

nos
@nos, thanks. So, do you mean to say a fclose on the FILE* and then an fwrite can actually cause this?
Jay
That's one possible cause, yes.
nos