Bugzilla – Bug 1869
clamdscan -m seems to work only with dirs
Last modified: 2018-03-29 13:50:48 EDT
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.
(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.
document this
manpage updated in master, moving this bug to unplanned
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).
Same if files/dirs are specified in -f.
-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).
clamd multiscan single file -> 0.96.1 rest 0.97
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.
-> 0.98
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.