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

[Bug]GetItemAsync and SetItemAsync throw System.Threading.Tasks.TaskCanceledException: 'A task was canceled.' #33

Closed
tripleacoder opened this issue Oct 1, 2020 · 13 comments · Fixed by #44
Labels
Bug Something isn't working Triage Issue needs to be triaged

Comments

@tripleacoder
Copy link

In my new app, I'm trying to use SessionStorage to store larger graphs of objects (a few hundreds).

However, I often get 'A task was canceled' from GetItemAsync and SetItemAsync. Also, Blazor shows the message "Attempting to reconnect to server" both when doing local debugging and when deployed to an IIS server.

What is the performance of SessionStorage when storing and retrieving 100s of objects? Is it advisable to do so?

Hosting Model:

  • Blazor Server
@tripleacoder tripleacoder added Bug Something isn't working Triage Issue needs to be triaged labels Oct 1, 2020
@chrissainty
Copy link
Member

chrissainty commented Oct 5, 2020

Hi @tripleacoder, the quick answer to your question is I don't know. When large amounts of data are stored in browser stroage (local or session) people seem to be finding issues like the one you've raised. I'm not sure yet if this is an issue with browser storage or something to do with Blazor/this library. Could you try and produce a minimal repro of the issue so I can debug it? So far we haven't been able to do that/had someone willing to do it.

@tripleacoder
Copy link
Author

I can repro it in my project right now, 100% of the time by calling SetItemAsync with a null argument.
It happens in an EditForm OnValidSubmit handler...

@chrissainty
Copy link
Member

Ok, but I need a working repro project. What you've just described is also different to your initial issue.

@tripleacoder
Copy link
Author

No, it seems related...

If I call SetItemAsync first with a complex object with 100 child objects it works.
But then I can repro the timeout if I call SetItemAsync (using the same key) with null, or a different, or the same object.

Could the problem be caused by the code that is erasing the previous entry?

@tripleacoder
Copy link
Author

This bug appears to be related to shared nodes in an object tree. I'm working on a repro project now.

@tripleacoder
Copy link
Author

I have made a repro project:
https://github.com/tripleacoder/BlazorApp3

@tripleacoder
Copy link
Author

Can you repro it..?

@larspage
Copy link

larspage commented Jan 4, 2021

Was this resolved? What if you use JSON or serialization?

@tripleacoder
Copy link
Author

Hi Chris,
Can this be given higher priority. It seems there is no real workaround and the error can appear suddenly and unpredictably, even with smaller object graphs.

@chrissainty
Copy link
Member

Hi @tripleacoder. Apologies this one slipped off my radar. I'll take a look at this at the weekend.

@tripleacoder
Copy link
Author

The bug is still there after upgrading to v. 2.1.0.
When I run the repro project I can reproduce the error 100% of the time.

@tripleacoder
Copy link
Author

The bug is also present when using the Newtonsoft JSON serializer instead of the default one.

@tripleacoder
Copy link
Author

@chrissainty
Hi Chris, will you re-open this issue as I believe the problem is still there after the code changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Triage Issue needs to be triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants