-
Notifications
You must be signed in to change notification settings - Fork 5.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
Many contract function calls/transactions via Web3 will eventually cause TCP ephemeral port exhaustion #926
Comments
See similar issue here, albeit on a different project raiden-network/raiden#253 |
The problem is that web3.js is a library running in node OR the browser, so it has no way to see system level port configurations. If you have any idea how we could improve the error messages, feel free to suggest. |
According to nodejs doc https://nodejs.org/docs/latest-v10.x/api/http.html#http_class_http_agent Injecting
|
I've closed this issue because the last maintenance release of 0.20.x is v0.20.7. |
### Description - This change should fix the flakey `error: Invalid JSON RPC response: ""` error that we often see in the protocol test beforeEach hooks (particularly those for the Attestations contract). - Implements a custom beforeEachWithRetries hook for the protocol tests package that will optionally retry beforeEach hooks and add sleep in between retries. This is necessary to avoid flakiness that seems to be caused by port exhaustion in CI and a mishandling of the error by web3. (See web3/web3.js#3425 and web3/web3.js#926). - I've only added `beforeEachWithRetries` to the Attestations tests because this error appears there the most. We can add it elsewhere in the future as needed. ### Other changes None ### Tested To see that this works, search logs for "retry" in https://circleci.com/gh/celo-org/celo-monorepo/248635 ### Related issues - Fixes #4570 ### Backwards compatibility Not applicable
### Description - This change should fix the flakey `error: Invalid JSON RPC response: ""` error that we often see in the protocol test beforeEach hooks (particularly those for the Attestations contract). - Implements a custom beforeEachWithRetries hook for the protocol tests package that will optionally retry beforeEach hooks and add sleep in between retries. This is necessary to avoid flakiness that seems to be caused by port exhaustion in CI and a mishandling of the error by web3. (See web3/web3.js#3425 and web3/web3.js#926). - I've only added `beforeEachWithRetries` to the Attestations tests because this error appears there the most. We can add it elsewhere in the future as needed. ### Other changes None ### Tested To see that this works, search logs for "retry" in https://circleci.com/gh/celo-org/celo-monorepo/248635 ### Related issues - Fixes celo-org#4570 ### Backwards compatibility Not applicable
Description:
Spamming Web3.js with a few thousand transactions or calls in quick succession will eventually (about 30 seconds) cause all available dynamic ports (16384 on Windows) to be consumed - however the vast majority are sitting in TIME_WAIT state (which can be confirmed by running netstat). The onreadystatechange event handler in the sendAsync function in HttpProvider will get called, but request.responseText is empty, causing an exception to be thrown, which is caught but results in an unhelpful error -
error: Invalid JSON RPC response: ""
Steps to reproduce:
Execute many successive contract function calls via Web3
Actual Behaviour:
error: Invalid JSON RPC response: ""
Error message is being passed into the web3 callback function.Expected Behaviour:
If all dynamic ports are consumed, then either return a descriptive error message, or hold off until ports are freed by the operating system, or make sure ports are being properly closed after use.
Notes:
To anyone seeing the same issue, it can be temporarily resolved by setting a timeout to wait until the ports are released by the operating system, or by manually increasing available dynamic TCP ports.
For more info - https://blogs.technet.microsoft.com/askds/2008/10/29/port-exhaustion-and-you-or-why-the-netstat-tool-is-your-friend/
Versions:
Geth 1.6.5 - Clique PoA
Web3.js 0.18.4
Windows 10
The text was updated successfully, but these errors were encountered: