-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Calling api.rpc.chain.getFinalizedHead
freezes whole WebSocket JSONRPC session
#11239
Comments
Logs on the Polkadot.js client:
|
Do you have anymore information when this happens? Is there something happening on the Parachain? Can you reproduce this locally? Can you reproduce this always for the same block? |
BackgroundTo mine on Khala/Phala, there is a tool to synchronize block data to and verify them in the TEE enclave. This tool will query The issueThis issue is found by our mining community. There are several miners facing this issue but unfortunately we can not reproduce this in our development environment. In this specific case(Phala-Network/runtime-bridge#83), the user started the tool when both the parent chain and the parachain were synched to the network height. Its jsonrpc session was frozen when querying getFinalizedHead on 2022-04-19T08:23:29.530Z where it turned to the 1503872rd block of the Khala chain. Since I am not familiar with Substate and Rust, I can only guess that querying I can set a watchdog for the jsonrpc session's keepalive failure for a workaround, but it do affect the reliability of the mining toolchains and the earning and income of the miners. |
hmm, so you don't have any logs from node that you connected to? Did you try to drop the WebSocket connection and start a new one? My hunch is that you run in to #10672 |
For this case we used Full log: https://github.com/Phala-Network/runtime-bridge/files/8511920/NODE.%2B.data_provider.zip |
Hey again, Thanks for the logs but there are only node logs from It should be sufficient to run with rpc node with |
@niklasad1 something I thought about. Why isn't this "ping-pong" mechanism that polkadot-js uses not backed into the protocol? |
Good question, it should be "baked" into the WebSocket protocol but when I checked polkadot-js it doesn't really use WebSocket ping/pong instead the warnings are printed when a call takes longer than some pre-defined timeout but I could be wrong.
|
@jacogr why not use the "ping-pong" protocol of websockets? |
I honestly cannot recall as to why (The timeout on specific calls is something completely different, it is on a per-call basis where it assumes something went wrong if a reponse is not received for a query inside a timeout window) Can certainly investigate WS-specific ping/pong, not sure if all the clients libs have it either (there are eg. different usages for Node.js vs the browser). Never looked into it, so cannot comment on server or client lib support and if it gets around the underlying drops. (Although this doesn't look promising, it mentions the ping/pong is normally from the server, not client - https://stackoverflow.com/a/50883592 and this mentions specifically that the JS browser side doesn't have control of it https://stackoverflow.com/a/10586583 so it would rather seem like a server-side config) |
Ok, we can add these as "server-side pings" when jsonrpsee is a thing in substrate if that works better because soketto supports it but it needs a fix in jsonrpsee (should be trivial though) |
Is there an existing issue?
Experiencing problems? Have you tried our Stack Exchange first?
Description of bug
In some case, calling api.rpc.chain.getFinalizedHead in Polkadot.js with the parachain will fail without any error message but a timeout error. After this, whole JSONRPC WebSocket session is frozen, we can get health warnings which indicate that the keepalive requests got no response.
It only happens on the Khala parachain, same rpc method works just fine on the kusama node, reproduced by the miner community.
Related:
api.rpc.chain.getFinalizedHead
freezes whole WebSocket JSONRPC session Phala-Network/phala-blockchain#736Steps to reproduce
No response
The text was updated successfully, but these errors were encountered: