threefoldtech / tfgrid-sdk-ts

Apache License 2.0
4 stars 8 forks source link

API-WS: Abnormal Closure #1395

Open scottyeager opened 10 months ago

scottyeager commented 10 months ago

After a playground tab has been open for a while, I start to see the following error in the browser console:

API-WS: disconnected from wss://tfchain.grid.tf/ws: 1006:: Abnormal Closure
apply @ index-e270ec15.js:97
error @ index-e270ec15.js:97
value @ index-e270ec15.js:110

This affects any playground tabs that I have open at the same time, so mainnet and testnet will both be affected, for example.

If I open a private window or restart my browser, the problem goes away.

zaelgohary commented 10 months ago

Investigation and Solution: The issue happens when the playground tab is left open for a while. Not sure if this is a network issue or something else. Still investigating.

zaelgohary commented 9 months ago

WIP: Some awaits were missing from function calls. That being said, the issue is still not completely fixed. I tried reproducing the issue and I got a different response every time. The ping method should be called every 20 secs, however, for some unknown reason, this doesn't happen. Sometimes the pinging stops while reading the request ID, sometimes it stops while reconnecting or connecting. The issue might happen because of anything that prevents a successful ping. Still investigating.

zaelgohary commented 9 months ago

Investigations:

The applied fix could make the ping function last longer but the issue remains. I tried to trace the issue but couldn't figure out the reason why it stops pinging.

scottyeager commented 6 months ago

I am still seeing this issue in 2.3.0 on the mainnet dashboard now. In this case today, I've tried loading my contracts view.

Here's a log snippet (thousands of these errors are produced):

image

The wheel just spins and spins:

image

It uses a full CPU core without mercy:

image

scottyeager commented 5 months ago

Today I have another occurrence. This time there's no huge CPU load, but a lot of log messages are being generated. It happened after waking my machine from sleep, so perhaps the interruption of connection to TF Chain at that time has something to do with it.

image

Mahmoud-Emad commented 4 months ago

I think @AhmedHanafy725 resolved this issue, will pass it to the blocked till Hanafy return back from his vacation