Skip to content
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

server: WaitForTransactionReceiptTimeoutError in account creation step #171

Open
nfmelendez opened this issue Nov 8, 2024 · 7 comments
Open
Assignees
Labels
bug Something isn't working high
Milestone

Comments

@nfmelendez
Copy link
Contributor

We are getting WaitForTransactionReceiptTimeoutError in the account creation step but the transaction is mined so is waiting for 3 minutes a receipt that is already there but the backend doesn't manage to know that.

We know that at the moment of polling for the receipt, there are no http request so is not polling the blockchain to know if the receipt exist.

Sentry error:

https://exactly.sentry.io/issues/6030727380/?project=4506186349674496&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&sort=date&statsPeriod=24h&stream_index=3&utc=true

Similar problems in viem:

  1. bug: simultaneous waitForTransactionReceipt calls never resolve wevm/viem#467
  2. waitForTransactionReceipt timeout exception after confirmed wevm/viem#2650
@nfmelendez nfmelendez self-assigned this Nov 8, 2024
@nfmelendez nfmelendez added bug Something isn't working high labels Nov 8, 2024
@nfmelendez nfmelendez added this to the alpha2 milestone Nov 8, 2024
@nfmelendez
Copy link
Contributor Author

nfmelendez commented Nov 8, 2024

When the error was triggered table order by time

EVENT ID USER.DISPLAY TIMESTAMP
9da1ac47 0x1c5a7f6107D743F394b5B02aBeB8FCA52814E26 Nov 8, 2024 2:54:49 PM UTC
8637154e (no value) Nov 8, 2024 2:43:02 PM UTC
b3cb1b5c (no value) Nov 8, 2024 2:41:45 PM UTC
94e605ee (no value) Nov 8, 2024 2:25:15 PM UTC
4d8d4ab8 (no value) Nov 8, 2024 1:42:53 PM UTC
bfa37170 0x35770825C78c41167a7a8C7511fAC4C208a4621 Nov 8, 2024 12:04:31 PM UTC
22578b89 (no value) Nov 8, 2024 11:02:04 AM UTC
a7f3b228 (no value) Nov 8, 2024 9:37:30 AM UTC
3d9e12e2 0x35770825C78c41167a7a8C7511fAC4C208a4621 Nov 8, 2024 9:14:34 AM UTC
743aec80 (no value) Nov 5, 2024 3:29:49 PM UTC
49a177c4 0x6120Fb2A944f7955298B80363F00C620dB9f6E6 Oct 30, 2024 12:26:24 PM UTC
f5a9b220 (no value) Oct 30, 2024 12:21:33 PM UTC
7d6cb6d6 (no value) Oct 30, 2024 12:08:10 PM UTC
e872cd71 0x6120Fb2A944f7955298B80363F00C620dB9f6E6 Oct 30, 2024 11:44:35 AM UTC

Link to sentry updated table

@cruzdanilo cruzdanilo changed the title WaitForTransactionReceiptTimeoutError in account creation step server: WaitForTransactionReceiptTimeoutError in account creation step Nov 11, 2024
@nfmelendez
Copy link
Contributor Author

Did a workaround so the poke is done even if the wait for transaction receipt timeout 1abc87c

@nfmelendez
Copy link
Contributor Author

I found a race condition in the observe.ts#47 that prematurely stop the polling and makes pedings wait for receipts timeout. The module assumes that a listener can send unwatch only 1 time but there is a sequence of steps that breaks that assumption creating the issue. if the number of listener is getListeners().length =2, the first unwatch with callbackId=2 will take it to getListeners().length =1, the second unwatch callbackId=2 will have getListeners().length =1, triggering the cleanup but callbackId=1 is still alive, the second unwatch will not unsubscribe because that was previously done. The cleanup triggers the polling to stop and wait for receipt will stop getting the block signal, therefore not checking receipt and will timeout.
The one that triggers multiple unwatch for the same listener(or callbackid) is the watchBlockNumber#135 when triggers many onBlockNumber for the range of blocks, that will triggers many times the onBlock of wait for receipt, that will trigger many times the done function, that will trigger many times unwatch

@nfmelendez
Copy link
Contributor Author

nfmelendez commented Nov 21, 2024

Create a test to reproduce the race condition with name "poke eth", https://github.com/exactly/mobile/tree/viem

@nfmelendez
Copy link
Contributor Author

nfmelendez commented Nov 27, 2024

Created a PR in viem that fixes the issue: wevm/viem#3068

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high
Projects
None yet
Development

No branches or pull requests

1 participant