Avast Rest read timeout

How to increase socket read timeout(so_rcvtimeo I guess) in avast-rest?
Now when was sent a large(3gb) file to /v1/avast/scan, the avast rest closed the connection after 30 seconds.
Message in logs: ERROR Session: [7fb9680045f0] read: The socket was closed due to a timeout

Hi, this timeout is currently hardcoded. I’ll check if it can be safely changed to “never”.

Note that scanning large files uploaded via the REST API is not optimal. The server first waits for the whole file to be uploaded, then is sends it over a unix socket to another process (avast-rest → avast), and then finally it is scanned. This means that at some point in time, there are two full copies of the file in memory.
We can optimize this so there will be only one copy at a time (by sharing memory), but that’s it.

To avoid copying gigabytes of data over network, you can share the file via a network mount and pass only the path to the scanner. This way, the scanner reads only parts of the file it actually needs (unless you enable the “scan full files” option, in which case it would read the whole file anyway). For large files, this might be more efficient, although also less flexible.

Thank you for your fast reply.

Version 4.3.0 (released today) adds recv_timeout config option (default changed to 300 seconds) and also fixes the performance / memory consumption issue I’ve described (there is now only one copy of the file in memory at any point in time).