INFURA / infura

Official Public Repository for INFURA
https://infura.io
381 stars 62 forks source link

Rinkeby Websocket connection is flaky on pulling new pending txns #139

Open FYJen opened 6 years ago

FYJen commented 6 years ago

I have been trying to connect to the Rinkeby websocket, Sometimes it works, sometimes it doesn't. I am using python web3.py. A similar question has been asked https://github.com/ethereum/web3.py/issues/1035, but I wasn't able to reproduce that yesterday. However, it gets flaky again today.

In [1]:

In [1]: from web3 import Web3

In [2]: web = Web3(Web3.WebsocketProvider('wss://rinkeby.infura.io/ws'))

In [3]: new_transaction_filter = web.eth.filter('pending')

In [4]: web = Web3(Web3.WebsocketProvider('wss://rinkeby.infura.io/ws'))

In [5]: new_transaction_filter = web.eth.filter('pending')

I cannot reproduce it on Ropsten and Mainnet as both gives me stable result (as in I was able to connect to the network repeatedly).

Is there anything special about infura's Rinkeby network support?

ryanschneider commented 6 years ago

Rinkeby is having network-wide consensus issues at the moment, so no new blocks are being mined.

That said, in general you shouldn't be inspecting pending transactions on our infrastructure, as the distributed nature of our infrastructure means you are not guaranteed to see all pending transactions, even ones you send yourself.

Also, there are underlaying issues with geth's subscription implementation which sometimes causes subscriptions to become soft-locked and not update, this would affect any geth node not just Infura's. We are just getting to the point of determining the source of these issues and potential remediations.

roschler commented 6 years ago

Rinkeby is having network-wide consensus issues at the moment, so no new blocks are being mined.

Is there a web page we can watch to check the status of this condition?

That said, in general you shouldn't be inspecting pending transactions on our infrastructure, as the distributed nature of our infrastructure means you are not guaranteed to see all pending transactions, even ones you send yourself.

That poses an interesting problem. Suppose you want to create a layer in your dApp that checks for "stalled" transactions and tries resubmitting them with a higher gas price but the same nonce. I recognize that with the Rinkeby mining strategy that's not very relevant, but it would be helpful to be able to test the strategy at least at an API level with Rinkeby before rolling out to the main network. Otherwise we will end up with "per-network" customizations in our dApps and that could be difficult to manage.

ryanschneider commented 6 years ago

Is there a web page we can watch to check the status of this condition?

https://www.rinkeby.io/#stats

At the time of the issue, the "Last Block Time" was not resetting but was instead creeping higher and higher, in this case several hours before the issue was resolved. I'll stress again this was a rinkeby-wide issue, not Infura-specific.

Suppose you want to create a layer in your dApp that checks for "stalled" transactions and tries resubmitting them with a higher gas price but the same nonce.

If the transactions are user-initiated, this would typically be something handled inside the users' wallet software (for example MetaMask offers just such a feature). If your app requires autonomous logic to send and process transactions of this nature on its own your best bet would be to run a local node alongside the server stack managing these transactions.

We have no short-term plans to offer a coherent pending pool offering at this time, but we have considered it for our longer term roadmap.

FYJen commented 6 years ago

@ryanschneider: Any update on the geth's node subscription issue you mentioned?

ryanschneider commented 6 years ago

@FYJen nothing yet, I've been focused on some other scalability issues so haven't had time to debug where the subscription subsystem might be soft locking, and then how to fix it.

FYJen commented 6 years ago

@ryanschneider: I see. I am following up on this because wss://rinkeby.infura.io/ws is completely unaccessible again today. Ropsten and mainnet remain working. For the time being, I am fine with not receiving all pending txns from the network due to the Infura's implementation you mentioned. However, I couldn't find much information of the Rinkeby network status on infura.

Could you help me check that the Rinkeby Websocket is live? Is anyone having the trouble as me?

ryanschneider commented 6 years ago

I'm not seeing any issues, can you give more details on how it's failing for you and how you are accessing it?

FYJen commented 6 years ago

@ryanschneider: I am using web3.py (4.4.1) to connect to Infura. The connection simply hung when I tried to connect to Infura Rinkeby websocket. I didn't dig into it because the connection has always been flaky for a while. It lasted exceptionally long today. But now, it is working again (shrug)