[Clamav-devel] clamd: Keep scanning while reloading database

Mark Pizzolato - ClamAV-devel clamav-devel at subscriptions.pizzolato.net
Mon Apr 7 15:17:03 EDT 2014

> > 1) Start reload_db() in a background thread, resume scanning, and call
> >    back once the new engine is in place; then exchange the pointers
> >    from old to new engine and free the old one.
> FWIW, I have implemented this option, and it seems to work just fine.
> Patch is pasted below.
> Do you see any problems with this approach?


I haven't looked closely, but how is the fact that each thread (which may currently be scanning a different file and may finish at some arbitrary time in the future) has a reference to the current engine object handled?  It would seem that some sort of a reference count could be used to manage which thread actually frees the engine object which is being replaced...  Maybe the settings object also needs a local reference in each of the scanning threads...

- Mark Pizzolato

More information about the clamav-devel mailing list