Web3py v7 added an async IPC provider. I have been testing it and discovered that it hangs when communicating with Anvil's IPC implementation. It works as expected with Reth's IPC implementation.
Comparing the responses from the IPC, I can see that Anvil omits the newline at the end of the response. Reth includes the newline.
Here are two responses captured from my node and an Anvil fork:
The hang occurs because the async IPC provider defers reading from the socket to asyncio's StreamReader.readline() method, which expects a \n separator. Not finding it, it continues to read from the socket until the timeout is reached.
I don't know if a newline is a convention or a requirement — it's unclear if web3py's newline expectation is wrong, or whether the omission is something Anvil should correct.
Component
Anvil
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (192a5a2 2024-10-26T00:22:40.192959901Z)
What command(s) is the bug in?
anvil
Operating System
Linux
Describe the bug
Web3py v7 added an async IPC provider. I have been testing it and discovered that it hangs when communicating with Anvil's IPC implementation. It works as expected with Reth's IPC implementation.
Comparing the responses from the IPC, I can see that Anvil omits the newline at the end of the response. Reth includes the newline.
Here are two responses captured from my node and an Anvil fork:
The hang occurs because the async IPC provider defers reading from the socket to asyncio's
StreamReader.readline()
method, which expects a\n
separator. Not finding it, it continues to read from the socket until the timeout is reached.I don't know if a newline is a convention or a requirement — it's unclear if web3py's newline expectation is wrong, or whether the omission is something Anvil should correct.