NomicFoundation / hardhat

Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
https://hardhat.org
Other
7.33k stars 1.42k forks source link

Undici timeouts are not handled correctly #3136

Open alcuadrado opened 2 years ago

alcuadrado commented 2 years ago

When upgrading to undici we introduced two problems:

  1. We are not passing the bodyTimeout here
  2. The way we are detecting if an error is a timeout is outdated here

Related to https://github.com/NomicFoundation/hardhat/issues/2672

github-actions[bot] commented 2 years ago

This issue is also being tracked on Linear.

We use Linear to manage our development process, but we keep the conversations on Github.

LINEAR-ID: 14ad93d2-d907-4826-a94c-3e9132847d06

ernestosperanza commented 2 years ago

Is this issue open to work?

fvictorio commented 2 years ago

@ernestosperanza sure, but make sure that you can reproduce the issue (check #2672) and that your fix indeed fixes it (see https://github.com/NomicFoundation/hardhat/blob/main/CONTRIBUTING.md#developing-locally to learn how to test a fix locally).

Saty248 commented 1 year ago

is this issue available to solve?

fvictorio commented 1 year ago

It is, but check my previous comment.

grapevinegizmos commented 1 year ago

This is a blocking problem for me. Hoping we get a solution soon.

Its worth noting that I see this problem (code "UND_ERR_HEADERS_TIMEOUT" only when I run on LocalHost. When I run the same code on on the transient bockchain (with hh test) I get no error.

jacque006 commented 1 year ago

Workaround from @samlaf : https://github.com/NomicFoundation/hardhat/issues/2672#issuecomment-1167409582 Example workaround implementation: https://github.com/web3well/bls-wallet/pull/341/files#diff-a2a940145025870fd09caa9fa093009d69793c78c5c9203195280575e5e4efb1R138-R143

alcuadrado commented 1 year ago

I started working on this in #3665

GopherJ commented 1 year ago
SocketError: other side closed
    at Socket.onSocketEnd (/home/ubuntu/paraspace-core/node_modules/undici/lib/client.js:995:22)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:489:12)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'UND_ERR_SOCKET',
  socket: {
    localAddress: '127.0.0.1',
    localPort: 36506,
    remoteAddress: undefined,
    remotePort: undefined,
    remoteFamily: undefined,
    timeout: undefined,
    bytesWritten: 616,
    bytesRead: 678
  }
}

is this error relevant? @alcuadrado @fvictorio I got this error when I run hardhat node on a VPS, but I cannot reproduce it locally on my PC

I cannot add timeout field to hardhat network config image

0xCourtney commented 8 months ago

I'm having a similar issue to https://github.com/NomicFoundation/hardhat/issues/2672 with requests that take more than ~20s, it seems that the Hardhat provider (more specifically Undici) will timeout. If anyone is in a similar situation, using the Ethers provider JsonRpcProvider instead of Hardhat seems to do the trick.

insider89 commented 5 months ago

Any update on this? Or workaround? I have the issue when trying to deploy smart contract on the Hedera Mainnet.

nsharmazbyte commented 4 months ago

Any update on this? Or workaround? I have the issue when trying to deploy smart contract on the Hedera Mainnet.

Were you able to resolve this?

insider89 commented 4 months ago

Were you able to resolve this?

I've added following setting to hardhat.config: timeout: 100_000, which resolve this issue for me.