Skip to content
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

Blazor failed to load large fils #15777

Closed
kant2002 opened this issue Jul 22, 2018 · 8 comments
Closed

Blazor failed to load large fils #15777

kant2002 opened this issue Jul 22, 2018 · 8 comments
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@kant2002
Copy link
Contributor

It is likely not Blazor issue per se, but I would be good if it fail more gracefully, if some inherent limitations from the Browser.

Basically I have following error in Chrome:

mono.js:1 Uncaught (in promise) RuntimeError: memory access out of bounds
    at wasm-function[290]:104
    at wasm-function[2458]:125
    at wasm-function[563]:16
    at wasm-function[246]:115
    at wasm-function[2428]:33
    at wasm-function[2429]:41
    at wasm-function[4877]:10
    at Module._mono_wasm_string_from_js (http://localhost:58134/_framework/wasm/mono.js:1:173587)
    at ccall (http://localhost:58134/_framework/wasm/mono.js:1:5651)
    at http://localhost:58134/_framework/wasm/mono.js:1:6032

My scenario following. I have form with input file.
User select text file.
Then application load file, split by lines and process file.
When I load file with only 914KB it works. When I load larger file 7876KB it fails to load with aforementioned error. Not sure who is to blame.

@SteveSandersonMS
Copy link
Member

Since this seems to be due to the underlying Mono WebAssembly platform rather than anything in Blazor, would you be able to report it to https://github.com/mono/mono? Please mention that this is WebAssembly-specific.

@kant2002
Copy link
Contributor Author

@SteveSandersonMS Seems to be this is indeed could handled on the Blazor side. @kumpera suggest that this is due to way how Blazor configure memory in Mono/WASM. Seems to be there no explicit memory limits in the Blazor and Mono think that memory unlimited, and as such it does not report OOM. If you think it would be worth investigation closes, I could take a look, since I don't like my current workaround for an issue.

@danroth27
Copy link
Member

@kant2002 I believe this will be addressed by https://github.com/aspnet/Blazor/issues/1606

@kant2002
Copy link
Contributor Author

@danroth27 thanks! From my understanding that's really the cause

@rpc-scandinavia
Copy link

rpc-scandinavia commented Feb 22, 2019

Hi, I experience something similar today, with Blazor 0.7.

  1. Form with file input, where I select one file.
  2. Get data from JS using the File interface.
  3. Get "WASM: GC_MAJOR: (LOS overflow)" error.

Everything works with files smaller then around 3 MB.

My first try, was to get the file content from JS in one big BASE64 string. That failed on +3 MB files.

My second try, was to get data from JS in smaller chuncks, and then build the Byte[] in C#. That failed on +3 MB files.

My last try, was to stop getting the data into a Byte[], and insted into a MemoryStream.
I discovered that the GC_MAJOR error occured, when I returned the Byte[] at the end of my GetData method (the return statement).
But when giving the GetData method a MemoryStream, and save the received data chuncks into that, I was able to "pass" the data from my GetData method, and pass it on to my PostData method without getting the GC_MAJOR error.

Now I am stuck at:

StreamContent httpContent = new StreamContent(httpDataStream);
await this.httpClient.PostAsync(httpServerAddress, httpContent);

Where I now get the CG_MAJOR error.
So I hope that it is fixed by #5617 or something else in Blazor 0.8 or soon.

@Suchiman
Copy link
Contributor

@rpc-scandinavia WASM: GC_MAJOR: (LOS overflow) isn't an error, it's a debug message, telling you that a full GC occured because the large object heap is full.

@rpc-scandinavia
Copy link

Thank you @Suchiman, I copy that. I am still working on my problem, and can see that the server receives and responds correctly to the request. In the browsers "Network" I can see that the response to the POST is correct. But I get a exceptiion, which didn't show before I used the MemoryStream (unless I didn't wait long ernough :-)

Error: System.InvalidOperationException at System.Threading.Tasks.TaskCompletionSource`1[TResult].SetResult (TResult result) <0x41c6f08 + 0x0001c> in <4b5441f51da44e28b14fa0baa2935bda>:0 at Microsoft.AspNetCore.Blazor.Browser.Http.BrowserHttpMessageHandler.ReceiveResponse (System.String id, System.String responseDescriptorJson, System.Byte[] responseBodyData, System.String errorText) <0x41b92b8 + 0x000e0> in <6e8b4c57aeeb4593b71c0de6d0ce9454>:0

@Suchiman
Copy link
Contributor

@rpc-scandinavia this is more interesting ReceiveResponse is the function JS calls when the response has been received here https://github.com/aspnet/Blazor/blob/5deb85df8784800742e7a6d68575c67dd6fedb5a/src/Microsoft.AspNetCore.Blazor.Browser/Http/BrowserHttpMessageHandler.cs#L112
This should only be able to happen if someone were trying to set the Result twice or error it once and then try to set it

@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/blazor Oct 27, 2019
@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label Oct 27, 2019
@dotnet dotnet locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

6 participants