Closed rburnashev85 closed 2 years ago
Thanks for reporting this issue, @rburnashev85.
This is expected behavior. When the user has navigated away from the application, we disconnect the Blazor server circuit to conserve resources.
To resolve this issue, you can implement JavaScript to detect that a user has returned to the web page and reconnect.
@danroth27 Can you share the docs link to this?
I don't think we ever officially documented this, but a suggested approach for doing this here: https://github.com/dotnet/aspnetcore/issues/10325#issuecomment-537979717.
Thank you for the answers. I understand that after some time Blazor server closes the connection. I use the script from #10325 on my site. It works as expected when the reconnect button appears. But the issue I have writen about is not the same. After few hours of downtime on mobile browsers the reconnect button doesn't appear. It seems like JS doesn't work at all. I see only prerendered page. Maybe it is because mobile browsers use some tricky cache mechanism or because JS crashes at an early stage of page initialization. It is hard to investigate because the browsers don't have console.
I tried to host my site on Nginx and on Kestrel without any reverse proxy. Nothing changed. Then I opened different sites on internet which made with blazor server side on the same mobile browsers. And I see the same problem there.
It is interesting that blazor web assembly sites after the same downtime are reloaded. Mobile browsers seems to reset those tabs that have not been opened for a long time.
Thanks for contacting us.
We're moving this issue to the Next sprint planning
milestone for future evaluation / consideration. We will evaluate the request when we will planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.
I've made some additional investigation on the issue. I used PreRenderComponent and added to MainLayout
@if (PreRenderFlag.IsPreRendering)
{
<a id="reload" class="reload" href="@NavigationManager.Uri">
Connection to server is lost. Please refresh the page.
</a>
}
The tag has css with animation which shows it after 10 seconds. Thus if blazor doesn't go beyond prerendering this tag appears.
Also I've added js script which would reload the page automatically after 10 seconds if this tag exists. However it doesn't work. So I conclude that js in this situation unfortunatelly doesn't work at all.
I tried following the repro steps but it seemed to work fine. After navigating to https://demos.devexpress.com/blazor/ChartSeriesTypes and then leaving the browser minimized for some hours, on returning I did get the reconnect UI as expected:
Then, after tapping "Reload", the page did reload and start working as expected.
Do you have any further information about how to reproduce the problem?
1) Open demos.devexpress.com. 2) Close the browser completely. 3) Open it after few hours. In my case you will see browser homepage. 4) Navigate to the demos.devexpress.com by clicking on the open tabs button (I marked it with a red circle).
It is important to open minimized tab in the browser not a new one.
My phone is Samsung Galaxy S8 with old latest updates including last versions of mobile browsers.
Chrome:
Firefox:
That is the equivalent of what I did, but it didn't repro on iOS 14.
@dotnet/aspnet-blazor-eng I don't have the hardware to try reproducing this on an up-to-date Android device. Do any of you?
I have a Galaxy S9 running Android 10 that I can validate this on. Will report back.
OK! Tried this out on Chrome (v85.0.4183.127). Although there was a brief loading period after the browser opened again, eventually all the charts were displayed.
@rburnashev85 Would you be able to retrieve logs from the session where this bug surfaces?
@rburnashev85 Would you be able to retrieve logs from the session where this bug surfaces?
I will try. I've changed LogLevel to Trace for System and Microsoft on my Server Side Blazor site.
Also check whether Lite mode in Chrome is enabled. My Chrome version is also 85.0.4183.127. Android 9.
These are logs from my site when this bug happens
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Hi. Thanks for contacting us. We're closing this issue as there was not much community interest in this ask for quite a while now. You can learn more about our triage process and how we handle issues by reading our Triage Process writeup.
23039 # Describe the bug
Blazor doesn't start after a long downtime on mobile browsers.
To Reproduce
1) Open any blazor server side site on chrome or firefox on android. For instance you can open this page https://demos.devexpress.com/blazor/ChartSeriesTypes 2) Minimize your browser and wait a few hours 3) Open the browser and with high propability you will see only prerendered page. All JS dynamic stuff doesn' work. No messages that you should update the page. If you follow some link on the page and then return back the page will still not work. The only way to restore its functionality is to refresh it manualy by clicking appropriate button in the browser.
P.S. Blazor Web Assembly sites restore without the issue.
Further technical details