Skip to content

Socket timeout when pushing a significant amount of data #2483

@carver

Description

@carver
  • Version: 5.29.0
  • Python: 3.8
  • OS: linux

What was wrong?

When pushing a big chunk of data to trin (>400 thousand hex chars), I got this:

    w3.provider.make_request('portal_historyStore', [content_key_hex, content_value_hex])
  File "/home/jcarver/code/eth-portal/venv-py3.8/lib/python3.8/site-packages/web3/providers/ipc.py", line 240, in make_request
    sock.sendall(request)
socket.timeout: timed out

I'm pretty open to the idea that trin is doing something wrong here, but I'm not sure what it might be yet. But it seems likely to me that I'm pushing more data than usual here. Note that increasing the timeout does seem to prevent the error. (It's flaky, but happened once in the first two runs with the original timeout, and hasn't happened since on 5+ runs with the longer timeout)

How can it be fixed?

The workaround I found so far is to patch my virtualenv copy of web3.py in web3/providers/ipc.py at:

- def get_ipc_socket(ipc_path: str, timeout: float = 0.1) -> socket.socket:
+ def get_ipc_socket(ipc_path: str, timeout: float = 2.0) -> socket.socket:

It seems that the timeout field is not set when PersistantSocket calls get_ipc_socket(), so there is no obvious way to configure it as a user.

This workaround won't work for long, because I can't ask users to do that. I guess I would have to do some pretty ugly monkey-patching to hide the issue from users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions