question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Out of Memory issue when uploading large files

See original GitHub issue

When we are uploading the large files with RestSharp, we randomly get some OutOfMemory issues. This happens because RestSharp is using HttpWebRequest behind the scene, and the default value for AllowWriteStreamBuffering is true. This mean that the whole file are loaded in memory when doing the query, in case there are some redirections to be able to replay it. But If we are uploading a 500 mb file, its an issue.

What we would need is to be able to set the AllowWriteStreamBuffering to false, but there is no way right now to alter the AllowWriteStreamBuffering in the ConfigureWebRequest.

Something like this would be sufficient for our need:

var request = new RestRequest(Method.POST); request.AllowWriteStreamBuffering = false; request.Files.Add(new FileParameter // ...

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
nevergiveupccommented, Apr 20, 2018

I encounter same issue and don’t how to deal with

0reactions
alexeyzimarevcommented, Oct 29, 2018

As @yvesmh rightfully mentioned in #1213, this issue can be solved by disabling the WebRequest write stream buffering. You can use the web request configuration on IRestClient to handle such cases.

client.ConfigureWebRequest(x => x.AllowWriteStreamBuffering = false);

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when uploading large file [Out of Memory]
When uploading a large file with the Reative web application, it seems that it is saved in the memory of the Client machine...
Read more >
Out Of Memory Error with larger file uploads
I have a battery of tests and have no issue running this with smaller files ~50MB and even 3-400MB files if running the...
Read more >
RAM being maxed out while uploading huge file
My buddy sent me the footage and I edited it ect. My issue is each time I try to upload the 14.4GB video...
Read more >
Large attachments may cause Out Of Memory errors and ...
Attempting to attach multiple large files at the same time may cause an OOM error. The attachment window may show the attachments loading...
Read more >
How to limit memory usage when uploading large files
The memory usage seems to occur as a result of chunking the large files, presumably because the chunks are held in the memory...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found