This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Help, any one ever meet hanging on _IO_lock_lock(list_all_lock) issue ?


Hi All ,
    
    I am using glibc 2.4 and meet problem as below:

    a)  There are four threads are hanging on _IO_lock_lock(list_all_lock).
        myfunc
         -->fopen 
            -->_IO_fopen@@GLIBC_2.1 
                -->  __fopen_internal
                   --> _IO_file_init@@GLIBC_2.1  (actually, it calls _IO_link_in--> _IO_lock_lock)
                      --> _L_lock_335
                          --> __lll_mutex_lock_wait

        From our analysis, the code is hanging on below: 
     
void
_IO_link_in (fp)
     struct _IO_FILE_plus *fp;
{
  if ((fp->file._flags & _IO_LINKED) == 0)
    {
      fp->file._flags |= _IO_LINKED;
#ifdef _IO_MTSAFE_IO
      _IO_cleanup_region_start_noarg (flush_cleanup);
      _IO_lock_lock (list_all_lock);                  // ******** 4 thread hanging here. ******* 
      run_fp = (_IO_FILE *) fp;
      _IO_flockfile ((_IO_FILE *) fp);
#endif
      fp->file._chain = (_IO_FILE *) INTUSE(_IO_list_all);
      INTUSE(_IO_list_all) = fp;
      ++_IO_list_all_stamp;
#ifdef _IO_MTSAFE_IO
      _IO_funlockfile ((_IO_FILE *) fp);
      run_fp = NULL;
      _IO_lock_unlock (list_all_lock);
      _IO_cleanup_region_end (0);
#endif
    }
}
INTDEF(_IO_link_in)
 
    b)  From gdb, member of typedef struct { int lock; int cnt; void *owner; } _IO_lock_t are below:
         (gdb) x /10x &list_all_lock
        0xb7da60a8 <list_all_lock>: 0x00000002 0xffffffff 0x8a1f3ba0

           lock: 0x00000002         seems somebody has taken this lock.
           cnt: 0xffffffff                it's very strange cnt is -1. it should be 1. 
           owner: 0x8a1f3ba0       actually the task of this owner is sleeping on the kernel without any lock. 

    
    Does anyone meet the same issue ? And whether fix it or not? 

    Any reply is welcome and helpful for me. 

Thanks a lot and Regards
Wuqixuan.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]