Error 408 “Request Timeout” in Kaspersky Scan Engine
Latest update: November 20, 2020
ID: 15644
Error 408 “Request Timeout” when sending requests with timeout
Cause
- If the response comes before the timeout specified in the request and displays the "Session Timeout" error, the issue is caused by the session timeout in Kaspersky Scan Engine. Response example:
HTTP/1.0 408 Request Timeout
Connection: close
Content-Type: text/plain
Server: KAVHTTPD/1.0
X-KAV-ProtocolVersion: 3
Date: Tue, 13 Oct 2020 09:43:07 GMT
Content-Length: 35
{
"error": "Session Timeout"
}
Connection: close
Content-Type: text/plain
Server: KAVHTTPD/1.0
X-KAV-ProtocolVersion: 3
Date: Tue, 13 Oct 2020 09:43:07 GMT
Content-Length: 35
{
"error": "Session Timeout"
}
- If the response comes after the timeout specified in the request and displays the "scanResult": “SERVER_ERROR” issue, the error is caused by the scanning task timeout. Response example:
HTTP/1.0 408 Request Timeout
Connection: close
Content-Type: text/plain
Server: KAVHTTPD/1.0
X-KAV-ProtocolVersion: 3
Date: Tue, 13 Oct 2020 10:43:20 AM GMT
Content-Length: 97
{
"object": "Memory",
"scanResult": "SERVER_ERROR"
}
Connection: close
Content-Type: text/plain
Server: KAVHTTPD/1.0
X-KAV-ProtocolVersion: 3
Date: Tue, 13 Oct 2020 10:43:20 AM GMT
Content-Length: 97
{
"object": "Memory",
"scanResult": "SERVER_ERROR"
}
Solution
- To fix the "Session Timeout" error, increase the session timeout. To do so, open the /etc/kavhttpd.xml configuration file and set SessionTimeout to a larger value. You can also increase the session timeout through Kaspersky Scan Engine Control Panel. See the guide below.
- To fix the “scanResult”: “SERVER_ERROR” issue, increase the scanning task timeout. To do so:
- If you are using API v3.0, increase the timeout value in the sent JSON structure.
- If you are using API v1.0 or 2.0, increase the value in the X-KAV-Timeout HTTP header.
Error 408 “Request Timeout” when scanning files
When scanning small compound files, Kaspersky Scan Engine can return a response with the error 408 "Request Timeout". The response can contain the following:
{
"object": "Memory", "scanResult": “SERVER_ERROR"
}
"object": "Memory", "scanResult": “SERVER_ERROR"
}
Or the following:
{
"error": “Session Timeout"
}
"error": “Session Timeout"
}
The error can occur when scanning:
- Archives
- Packaged disk images
- Installation packages in the MSI, EXE or APK format
- Java files in the JAR, EAR or WAR format
Cause
The error is caused by the fact that these files, despite their small size, may contain a large number of subobjects. Scanning these subobjects requires sufficient time.
Solution
- Increase the session timeout. To do so, open the /etc/kavhttpd.xml configuration file and set SessionTimeout to a larger value. You can also increase the session timeout through Kaspersky Scan Engine Control Panel. See the guide below.
- Increase the scanning task timeout. To do so:
- If you are using API v3.0, increase the timeout value in the sent JSON structure.
- If you are using API v1.0 or 2.0, increase the value in the X-KAV-Timeout HTTP header.
How to increase the session timeout through Kaspersky Scan Engine Web Console
- Open Kaspersky Scan Engine Web Console and go to Settings → Scanning.
- Set the timeout in milliseconds in the Object scan timeout (ms) field.
The time specified in this field should be enough to establish a connection, transfer a file to Kaspersky Scan Engine, scan the file and send a response. We recommend that you set a period of time long enough to transfer and scan all the files you plan to check.
The timeout session will be increased.