Hi,

I'm using libclamav in a forking mail filter. After the library is loaded, it is passed to a forked child for every file. This has always worked fine, except for the time taken by cl_engine_free(). I find the program hanging at mpool_free() for quite some time.

The problem is when the filter has to stop, because its parent only waits 15 seconds. Is there any kind of solution, apart from avoiding calls to cl_engine_free()?

I run a test program that forks for each argument on the command line. Each child scans its argument. To make LeakSanitizer happy, I run cl_engine_free() also on child exit. It seems the time taken grows more than linearly with the number of arguments:


$ ./testfilter $(ls -1 ~/tmp/*.eml|head -4)
virus data loaded in: 21 sec(s)
cl_engine_free() in 2.290742s at child
cl_engine_free() in 2.551281s at child
cl_engine_free() in 2.558481s at child
cl_engine_free() in 2.609578s at child
cl_engine_free() in 1.536840s at main

$ ./testfilter $(ls -1 ~/tmp/*.eml|head -8)
virus data loaded in: 20 sec(s)
cl_engine_free() in 3.940075s at child
cl_engine_free() in 3.898482s at child
cl_engine_free() in 4.238972s at child
cl_engine_free() in 4.574296s at child
cl_engine_free() in 4.498217s at child
cl_engine_free() in 4.521290s at child
cl_engine_free() in 4.473109s at child
cl_engine_free() in 4.618015s at child
cl_engine_free() in 1.556344s at main


$ ./testfilter $(ls -1 ~/tmp/*.eml|head -12)
virus data loaded in: 20 sec(s)
cl_engine_free() in 8.114131s at child
cl_engine_free() in 8.291846s at child
cl_engine_free() in 8.529518s at child
cl_engine_free() in 8.622147s at child
cl_engine_free() in 8.809577s at child
cl_engine_free() in 9.535822s at child
cl_engine_free() in 10.034780s at child
cl_engine_free() in 9.889573s at child
cl_engine_free() in 10.202081s at child
cl_engine_free() in 10.553096s at child
cl_engine_free() in 11.202486s at child
cl_engine_free() in 11.074945s at child
cl_engine_free() in 8.223201s at main

TIA
Ale
--





_______________________________________________

Manage your clamav-users mailing list subscription / unsubscribe:
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/Cisco-Talos/clamav-documentation

https://docs.clamav.net/#mailing-lists-and-chat

Reply via email to