Hi, We have an multi-threaded application which makes use of libclamav.dll to scan various files. The job of each thread is to pick up different files and pass them along to cl_scandesc() for scanning. When scan is performed on a larger file sets(several 1000's of files), the scan works fine for the some time but gets stuck after one to two hours of scanning. I could see that cl_scandesc() was not returning. This happens most of the time(if not always). After debugging libclamav, I found that two of the threads were getting in to a deadlock. I couldnt find the exact cause of why _lock() and _open() could possibly trigger a deadlock. Has anybody faced similar issues?.
We are on 0.95.2 version of ClamAV source. 3 Id: 36c.3d0 Suspend: 1 Teb: 7ffdc000 Unfrozen ChildEBP RetAddr Args to Child 08c33694 7c827d0b 7c83d236 0000064c 00000000 ntdll!KiFastSystemCallRet 08c33698 7c83d236 0000064c 00000000 00000000 ntdll!NtWaitForSingleObject+0xc 08c336d4 7c83d281 0000064c 00000002 003821bc ntdll!RtlpWaitOnCriticalSection+0x1a3 08c336f4 7c353284 003821bc 00000100 00000080 ntdll!RtlEnterCriticalSection+0xa8 08c33730 7c362fe8 00000000 061af008 00000000 MSVCR71!_alloc_osfhnd+0xbe [f:\vs70builds\3052\vc\crtbld\crt\src\osfinfo.c @ 112] 08c33760 7c363163 08c33790 08c3378c 08c344d8 MSVCR71!_tsopen_lk+0x199 [f:\vs70builds\3052\vc\crtbld\crt\src\open.c @ 366] 08c337ac 10017a9b 08c344d8 00000301 00000180 MSVCR71!_open+0x2d [f:\vs70builds\3052\vc\crtbld\crt\src\open.c @ 110] 08c350e8 10019e93 08c3510c 0606e028 00000000 libclamav!cli_html_normalise+0x30b 08c35138 1004f3cc 0606e028 00000000 08c385c4 libclamav!html_normalise_fd+0xa3 08c35578 10051237 00000013 00000001 08c385c4 libclamav!cli_scanhtml+0xfc 08c355c4 1006442f 00000013 08c385c4 00000013 libclamav!cli_magic_scandesc+0x367 08c38260 100751f7 00b5d920 09186214 1006427a libclamav!unz+0x1bf 08c3828c 08c385c4 06372ac0 006d492d 00972644 libclamav!cli_regfree+0x67 72] WARNING: Frame IP not in any known module. Following frames may be wrong. 00000000 00000000 00000000 00000000 00000000 0x8c385c4 4 Id: 36c.eac Suspend: 1 Teb: 7ffdb000 Unfrozen ChildEBP RetAddr Args to Child 08d37aac 7c827d0b 7c83d236 0000070c 00000000 ntdll!KiFastSystemCallRet 08d37ab0 7c83d236 0000070c 00000000 00000000 ntdll!NtWaitForSingleObject+0xc 08d37aec 7c83d281 0000070c 00000004 00000001 ntdll!RtlpWaitOnCriticalSection+0x1a3 08d37b0c 7c342139 00385148 00000288 08d37b58 ntdll!RtlEnterCriticalSection+0xa8 08d37b1c 7c3531ed 0000000b 7c38c960 00000288 MSVCR71!_lock+0x2e [f:\vs70builds\3052\vc\crtbld\crt\src\mlock.c @ 319] 08d37b58 7c3616e7 7c38c960 00000288 00000012 MSVCR71!_alloc_osfhnd+0x27 [f:\vs70builds\3052\vc\crtbld\crt\src\osfinfo.c @ 59] 08d37b90 7c3617f5 00000012 00000012 06088008 MSVCR71!_dup_lk+0x33 [f:\vs70builds\3052\vc\crtbld\crt\src\dup.c @ 104] 08d37bc4 10022588 00000012 08d385c4 06088008 MSVCR71!_dup+0x55 [f:\vs70builds\3052\vc\crtbld\crt\src\dup.c @ 74] 08d37ff0 1005051f 06088008 08d385c4 00000215 libclamav!cli_parse_mbox+0x28 08d38004 100512d0 00000012 08d385c4 00000144 libclamav!cli_scanmail+0x7f1559] 08d38050 10063dba 00000012 08d385c4 00000012 libclamav!cli_magic_scandesc+0x400 08d3848c 1004fc23 00b848e0 00000007 00000001 libclamav!cli_untar+0x9a 08d384a8 1005137b 00000007 00000001 7c342151 libclamav!cli_scantar+0x73 08d384f8 1004e27b 00000007 08d385c4 00000007 libclamav!cli_magic_scandesc+0x4ab 08d38564 10051111 08d385c4 08d385f0 06458600 08d385b0 100517a7 00000003 08d385c4 00000000 libclamav!cli_magic_scandesc+0x241 08d385ec 004016b7 00000003 08d3a660 08d3a65c libclamav!cl_scandesc+0x572157] 0:004> !locks CritSec +385148 at 00385148 WaiterWoken No LockCount 4 RecursionCount 1 OwningThread 3d0 EntryCount 0 ContentionCount 421e *** Locked CritSec +3821bc at 003821bc WaiterWoken No LockCount 1 RecursionCount 1 OwningThread eac EntryCount 0 ContentionCount 576 *** Locked Thanks, Biplab _______________________________________________ http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-win32
