Cisco-Talos / clamav

ClamAV - Documentation is here: https://docs.clamav.net
https://www.clamav.net/
GNU General Public License v2.0
4.27k stars 692 forks source link

Clanscan will eat all memory and cpu on an AWS t2.small box #1254

Closed danbuntu closed 5 months ago

danbuntu commented 5 months ago

Describe the bug

I have an upto date Ubuntu server version 22.04.4 running on AWS as a small instance - 1 cpu and 2gig of ram.

When I run clamscan against a file from the terminal with

clamscan testfile.txt

the cpu spikes to 100%, the memory is gobbled up and the server locks up entirely. I have to force reset it.

Is there any way to limit the memory usage or similar?

How to reproduce the problem

Bring up an AWS server t2.small using the 22.04 aws template

SSH to the server

run clamscan .

wait a minute and watch the server lock up

micahsnyder commented 5 months ago

2GB is not enough RAM to run ClamAV.

https://docs.clamav.net/#recommended-system-requirements

Sorry!

danbuntu commented 5 months ago

3 gig jeepers

I think I might have solved the problem though. Turned out that AWS Ubuntu boxes don't have swap enabled be default. I created a 1 gig swap file and the scans now work - albeit with high resource usage whilst they run.

Our t2.small our development machines so I think this will be ok. The prod boxes are much bigger.

micahsnyder commented 5 months ago

3 gig jeepers

I know 😞