libyal / libvmdk

Library and tools to access the VMware Virtual Disk (VMDK) format
GNU Lesser General Public License v3.0
168 stars 66 forks source link

Failure case by Deadlock condition detected when I enabled multi-thread support. #19

Closed zhanleewo closed 2 years ago

zhanleewo commented 5 years ago

Failure case by Deadlock condition detected when I enabled multi-thread support.

Command:

./vmdktools/vmdkinfo -v ./vmdktools/R1.vmdk

Error Message:

libcthreads_read_write_lock_grab_for_write: unable to lock read/write lock for write with error: Deadlock condition detected.
libvmdk_handle_open_file_io_handle: unable to grab read/write lock for writing.
libvmdk_handle_open: unable to open handle using a file IO handle.
info_handle_open_input: unable to open input handle.

Full output with -v:

vmdkinfo 20190316

libvmdk_extent_file_read_file_header: reading file header at offset: 0 (0x00000000)
libvmdk_extent_file_read_file_header_data: file header:
00000000: 4b 44 4d 56 01 00 00 00  03 00 00 00 00 00 80 0c   KDMV.... ........
00000010: 00 00 00 00 80 00 00 00  00 00 00 00 01 00 00 00   ........ ........
00000020: 00 00 00 00 14 00 00 00  00 00 00 00 00 02 00 00   ........ ........
00000030: 15 00 00 00 00 00 00 00  2e 32 00 00 00 00 00 00   ........ .2......
00000040: 80 64 00 00 00 00 00 00  00 0a 20 0d 0a 00 00 00   .d...... .. .....
00000050: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
...
000001f0: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........

libvmdk_extent_file_read_file_header_data: signature                    : KDMV
libvmdk_extent_file_read_file_header_data: format version               : 1
libvmdk_extent_file_read_file_header_data: flags                    : 0x00000003
    New line detection valid
    Use secondary grain directory

libvmdk_extent_file_read_file_header_data: maximum data number of sectors       : 209715200
libvmdk_extent_file_read_file_header_data: grain number of sectors          : 128
libvmdk_extent_file_read_file_header_data: descriptor sector number         : 1
libvmdk_extent_file_read_file_header_data: descriptor number of sectors         : 20
libvmdk_extent_file_read_file_header_data: number of grain table entries        : 512
libvmdk_extent_file_read_file_header_data: secondary grain directory sector number  : 21
libvmdk_extent_file_read_file_header_data: primary grain directory sector number    : 12846
libvmdk_extent_file_read_file_header_data: metadata number of sectors           : 25728
libvmdk_extent_file_read_file_header_data: is dirty                 : 0x00
libvmdk_extent_file_read_file_header_data: single end of line character         : 0x0a
libvmdk_extent_file_read_file_header_data: non end of line character            : 0x20
libvmdk_extent_file_read_file_header_data: first double end of line character       : 0x0d
libvmdk_extent_file_read_file_header_data: second double end of line character      : 0x0a
libvmdk_extent_file_read_file_header_data: compression method               : 0 (None)
libvmdk_extent_file_read_file_header_data: padding:
00000000: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
...
000001a0: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ........ ........
000001b0: 00                                                 .

libvmdk_extent_file_read_file_header_data: number of grain directory entries        : 3200

libvmdk_extent_file_read_descriptor_data_file_io_handle: reading descriptor at offset: 512 (0x00000200)
libvmdk_descriptor_file_read_header: value: 0               : # = Disk DescriptorFile
libvmdk_descriptor_file_read_header: version                : 1
libvmdk_descriptor_file_read_header: encoding               : GBK
libvmdk_descriptor_file_read_header: content identifier         : 74eda389
libvmdk_descriptor_file_read_header: parent content identifier      : ffffffff
libvmdk_descriptor_file_read_header: value: 5               : isNativeSnapshot = no
libvmdk_descriptor_file_read_header: disk type              : monolithicSparse

libvmdk_extent_descriptor_read: value string                : RW 209715200 SPARSE "R1.vmdk"
libvmdk_extent_descriptor_read: access                  : RW
libvmdk_extent_descriptor_read: number of sectors           : 209715200
libvmdk_extent_descriptor_read: type                    : SPARSE
libvmdk_extent_descriptor_read: filename                : R1.vmdk

libvmdk_descriptor_file_read_disk_database: value: 18           : ddb.longContentID = 113ce0e5abd9e83a73f7010374eda389
libvmdk_descriptor_file_read_disk_database: value: 21           : ddb.uuid = 60 00 C2 95 a5 84 0c cb-11 a4 48 6c 4c b1 d9 49

Unable to open source file(s).
libcthreads_read_write_lock_grab_for_write: unable to lock read/write lock for write with error: Deadlock condition detected.
libvmdk_handle_open_file_io_handle: unable to grab read/write lock for writing.
libvmdk_handle_open: unable to open handle using a file IO handle.
info_handle_open_input: unable to open input handle.

Automake Configure

./configure --enable-static-executables=yes  --enable-verbose-output --enable-debug-output

Configure Report

configure:
Building:
   libcerror support:                         local
   libcthreads support:                       local
   libcdata support:                          local
   libclocale support:                        local
   libcnotify support:                        local
   libcsplit support:                         local
   libuna support:                            local
   libcfile support:                          local
   libcpath support:                          local
   libbfio support:                           local
   libfcache support:                         local
   libfdata support:                          local
   libfvalue support:                         local
   DEFLATE compression support:               local
   FUSE support:                              libfuse

Features:
   Multi-threading support:                   pthread
   Wide character type support:               no
   vmdktools are build as static executables: yes
   Python (pyvmdk) support:                   no
   Verbose output:                            yes
   Debug output:                              yes
zhanleewo commented 5 years ago

pthread_rwlock_wrlock does not initialize?

joachimmetz commented 5 years ago

Per readme the thread safety (RW locking) is still WIP, I'll have a look if I can reproduce it. What operating system/platform are you using to build the source?

zhanleewo commented 5 years ago

I using ubuntu desktop 18.04 64bit. acutally single thread mode is ok for my propose.

joachimmetz commented 2 years ago

This is likely related to ./configure --enable-static-executables. Closing this issue in favor of https://github.com/libyal/libyal/issues/81

For now add --enable-multi-threading-support=no