-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Downloading a large file from VQL fails #4008
Comments
When you say a temporary file what do you mean? It should not need to create any temporary file to upload an existing file. Do you have anything in the query logs? |
Let me clarify that "upload" here refers to artifact parameter type called "upload". Here is an example artifact I am using to consistently reproduce the issues: name: Issue4008
description: |
Print size of downloaded file
type: CLIENT
parameters:
- name: File
type: upload
sources:
- precondition:
SELECT OS From info() where OS = 'linux'
query: |
LET Result = SELECT stat(filename=tempfile(data=File)) AS Stat
FROM scope()
SELECT *, humanize(bytes=Stat.Size) AS Size
FROM Result I've done more testing, and smaller files work just fine. Large files (100+ MB) never work, and either "complete" after about 4 MB or time out. The server log contains nothing, and the client logs not much either. I've tried to rule out wss as a culprit, but nothing changed. This is what I deem as the only relevant log row from the client (this uses wss, but using http-only server URIs doesn't seem to make a difference):
|
I get the same result. There seems to be a fixed limit where only 4194304B = 4096KB = 4.2MB gets delivered to the client. It completes immediately without errors (i.e. no timeout issue) The large file is correctly uploaded to /public on the server and can be fetched from the download link in the collection log, and it delivers the full file. |
This is working as intended. The vql compiler generates the following vql for an upload parameter https://github.com/Velocidex/velociraptor/blob/master/services%2Flauncher%2Fcompiler.go#L75 This calls http client to retrieve a file into the vql scope. Because the chunk size is not specified the default is 4mb. We don't generally want to allow http client to download massive files into memory so there is a reasonable limit. If you want to go larger you should use http client manually with a temp file to overcome the limit or specify a larger chunk size ( not recommended). |
I've been trying to download a 108 MB file using either FetchBinary or a upload-type parameter. The download never succeeds. The following various behaviours are observed:
A smaller file works just fine. Tested with both client v. 0.73.3 and 0.7.1. Server is 0.73.3.
The text was updated successfully, but these errors were encountered: