ethereum/go-ethereum

Geth >= 1.8.3 can't deploy large contracts over websockets

cgewecke opened this issue · 10 comments

System information

Geth version: >= 1.8.3
OS & Version: OSX
Commit hash : (if develop)

Expected behaviour

Should deploy contracts of any (legal) size over websockets.

Actual behaviour

If the data sent has a length > 16416 the websocket connection fails and closes - all subsequent calls receive the error message:

Error: CONNECTION ERROR: Couldn't connect to node on WS.

Steps to reproduce the behaviour

Deploy a large contract over websockets to Geth 1.8.2 (Succeeds)
Deploy a large contract over websockets to Geth >= 1.8.3. (Errors)

Example of a contract that fails can be found at ethpm/escape-truffle where we are trying to run tests in CI using geth --dev but larger deployments like this one which consumes +/- 3 million gas trigger the error.

This problem is also being tracked at web3 here because web3 crashes on the geth response.

@cz3kit discovered the data size limit mentioned above and may have more reproduction info.

I deployed the following contract using geth 1.8.9
contract Test{ string public test; function setString(string _msg) public { test = msg; } }
When I call the function setString with up to 8009 times 'a', everything is fine. But as soon I send 8010 'a', geth gives the following message:
read error unexpected EOF

As soon I repeat the same test with geth 1.8.2, all is fine.

And I don't think this is necessarily even to do with large contracts solely. I think there have been regressions in some of the events when websocket code was rewritten. cc/ @karalabe any insight into this? Any way we can help to fix?

We're seeing websocket connections constantly getting killed. Seemingly at random. My hunch is that it is related to too large a frame size for web3. Any insight here would be great.

+1

djvs commented

Likely related - trying to send a 28kb whisper message over WS is giving:

Error: Failed to send direct message: Error: CONNECTION ERROR: Couldn't connect to node on WS.

The max message size of course being at the standard 1MB.

djvs commented

Some kind of issue with socket buffers overflowing? A hard-set message limit?

Hope this gets fixed soon, it's gonna require some difficult workarounds if not.

So in web3 a patch came in that now allows you to pass config options to the websocket provider but it's for NodeJS only. Won't work in the browser. web3/web3.js#1631.

As a result if this is where you are affected you can increase the frame buffer size as a temporary workaround like this: web3/web3.js#1217 (comment).

We got the same issue (embarklabs/embark#1028).

We currently use web3 beta 34 since 36 has issues with deploying some contracts, so the current workaround for us is to either use RPC (yuck), use Ganache-cli or use Parity.

I get this issue while using geth 1.8.17-stable, migrating with Truffle and a web3@1.0.0-beta.37 WebsocketProvider. I can successfully deploy a contract with bytecode that is 16216 characters (including "0x") long. If you add one more character I get the above behavior. Does anyone have any insight into this?

More specifically I think the call that was failing was a web3Contract.estimateGas call.

Truffle issue #1699 references this issue.