-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
Client's SubscribeFilterLogs stops reporting events after some time #23845
Comments
Any chance you could provide some of the geth log around the time it happens? |
Hard for me to identify when it starts failing as I monitor for a few events a day only... Might try to find something by finding events that were missed manually and looking at the time. |
Having the same issue. Could it be related to a disconnection and the function is not notified? Maybe keep making a ping to the WS to avoid disconnection? |
Not for me as I'm connected through IPC. |
Weird, I am connecting over an Alchemy/Infura websocket and it will intermittently drop events after some time. I redeployed my service today while including the Subscription call inside the for, to see if by recreating the subscription on each loop, it would not drop. I am not sure if it works on the long term but so far it hasn't given me an issue.
|
Thanks @Vanclief , looks like it could be a helpful workaround if the subscription ends up in a bad state somehow after an event is picked up. I have for now abandonned the project that was using the code above so I won't be able to test it immediately, but I plan on running it again at some point. |
@Vanclief i am facing a similar issue, and it seems to me that the when an error happen, the subscription get stuck in an infinite look emit and error to the channel with null and logging error happened |
@xiezm thanks a lot, this could definitely help. I still think that this issue should be fixed here. |
@xiezm Thanks for sharing, that definitely looks like the correct way to do it instead of just spamming new ws connections. |
workaround for ethereum/go-ethereum#23845
workaround for ethereum/go-ethereum#23845
I did a little spelunking around the
Could that be the underlying cause? The duration of 5 minutes seems to roughly match when we stop receiving events. It looks like the |
@lalexgap the duration was much longer for me, and I think this timeout is only triggered if you do not poll for the duration. As long as you poll the filter, it should stay alive. |
workaround for ethereum/go-ethereum#23845
any update on this issue? I'm seeing an error after some hours of using the subscription of a tcp i/o timeout. The case of sub.Err() catches the tcp i/o timeout when it happens and exits the application. Do we need some retry logic for these, anyone ran into this issue? ` sub, err := e.client.SubscribeFilterLogs(ctx, q, e.logUpdate)
|
Bumping this one. In my specific case, I avoid getting
Now, the problem is that the subscription somehow "times out" after some time without receiving new events from the contract. And on this case I don't expect to receive daily events, but from time to time. The subscription never fails or sends an error, it's just simply silently times out. If new events happen after this point the sub won't ever receive them again. In order to reactivate it the service must be restarted, and it will receive all the last events happened since it died. So, at some point in the subscription lifecycle it's dying and not being properly notified with an Unsubscribe. |
Bumping this.
I'm running the script in pair with a local hardhat node. An interesting moment: |
System information
go-ethereum v1.10.8
OS & Version: linux
Expected behaviour
When using
ethclient.Client.SubscribeFilterLogs
, all events matching the filter are caught.Actual behaviour
After some time, the script stops reporting new events and it needs to be restarted to start working again.
Steps to reproduce the behaviour
Hard for me to convey what needs to be done. I guess try to leave a script running for days and see if it stops catching new events after a while.
I'm not sure what could cause this issue. I automated script restart with cron to try to mitigate this issue but it still happens that the
SubscribeFilterLogs
stops reporting new events.The text was updated successfully, but these errors were encountered: