Bug 1869 - clamdscan -m seems to work only with dirs
clamdscan -m seems to work only with dirs
Status: NEW
Product: ClamAV
Classification: ClamAV
Component: clamd
ALL
x86 GNU/Linux
: P3 normal
: old_bug_triage
Assigned To: ClamAV team
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-03-09 16:24 EST by Luca Gibelli
Modified: 2018-03-29 13:50 EDT (History)
4 users (show)

See Also:
QA Contact:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Gibelli 2010-03-09 16:24:49 EST
From the manual of clamdscan:

      -m, --multiscan
              In multiscan mode several files are scanned in parallel, one for
              each  available  scan  thread in clamd.  

However if I use:

$ clamdscan -m file1 file2 file3 ...

it looks like files are scanned one at a time. "top" shows only one cpu being used, even if I have MaxThreads set to 6.

If I run:

$ clamdscan -m dir/

I can see that all cpus are used, and scanning is much faster.
Comment 1 Török Edwin 2010-03-09 17:47:07 EST
(In reply to comment #0)
> From the manual of clamdscan:
> 
>       -m, --multiscan
>               In multiscan mode several files are scanned in parallel, one for
>               each  available  scan  thread in clamd.  
> 
> However if I use:
> 
> $ clamdscan -m file1 file2 file3 ...
> 
> it looks like files are scanned one at a time. "top" shows only one cpu being
> used, even if I have MaxThreads set to 6.
> 
> If I run:
> 
> $ clamdscan -m dir/
> 
> I can see that all cpus are used, and scanning is much faster.

multiscan command only accepts on argument, which can be a file or a dir (not much point if its a file).
clamdscan should probably use an idsession+contscan for the individual files, and multiscan for the dirs.
Comment 2 Tomasz Kojm 2010-03-12 17:10:46 EST
document this
Comment 3 Tomasz Kojm 2010-03-18 16:28:27 EDT
manpage updated in master, moving this bug to unplanned
Comment 4 Török Edwin 2010-04-21 22:21:52 EDT
clamd shall be fixed to handle MULTISCAN <singlefile> same as SCAN <singlefile> (so it doesn't need to eat one of the MaxThreads for a control thread),
and clamdscan shall be improved like this:

-m <single file | dir>, sends to clamd MULTISCAN <param>

-m <file1> <file2>
-m <dir1> <dir2> <file1> <file2>, sends to clamd:
 IDSESSION
   SCAN dir1/file01
   SCAN dir1/file02
....
   SCAN file1
   SCAN file2
 END

i.e. clamdscan will recurse itself, just like with remote clamds. But unlike with remote clamds, it will pass SCAN instead of INSTREAM.

Also clamd should reject CONTSCAN and MULTISCAN in IDSESSION mode (the manpage says they are not accepted inside IDSESSION, but I'm not sure if clamd actually rejects them).
Comment 5 Török Edwin 2010-04-21 22:22:16 EDT
Same if files/dirs are specified in -f.
Comment 6 Török Edwin 2010-04-21 22:25:20 EDT
-f can assume it'll have more than one file, and go the IDSESSION route (even if later it turns out it had a single file/dir).
Comment 8 Török Edwin 2010-04-23 17:00:30 EDT
clamd multiscan single file -> 0.96.1
rest 0.97
Comment 9 Török Edwin 2010-07-26 11:58:28 EDT
clamav-0.96-210-gcdb3cbe(In reply to comment #4)
> clamd shall be fixed to handle MULTISCAN <singlefile> same as SCAN <singlefile>
> (so it doesn't need to eat one of the MaxThreads for a control thread),

Done in clamav-0.96-210-gcdb3cbe.

> and clamdscan shall be improved like this:

(In reply to comment #8)
> clamd multiscan single file -> 0.96.1
> rest 0.97

Retargeting the rest for 0.97.
Comment 10 Török Edwin 2010-11-03 16:08:05 EDT
-> 0.98
Comment 11 Micah Snyder 2018-03-29 13:50:48 EDT
Multithreaded scanning is now default in clamd/clamdscan.  

We consider removing the --multiscan/-m option from clamdscan unless there is a compelling reason not to.

Re-purposing this ticket to remove the option.

We can check if multithreaded scanning does occur when the scan targets are files vs directories.  I suspect it works correctly now.