Getting error curl: (56) Recv failure: Connection reset by peer

11,467

First of all please check if there is firewall. Disable it. Then remove the IP address provided in core.yaml file in operations tab. So that line will look like a below:

operations:
    # host and port for the operations server
    listenAddress: :9443

This change worked for me.

Share:
11,467
Kartik Chauhan
Author by

Kartik Chauhan

Updated on June 04, 2022

Comments

  • Kartik Chauhan
    Kartik Chauhan almost 2 years

    I know this error has been posted before on StackOverflow and many solutions/answers are available too. But, I've already gone through all those answers and couldn't find any viable solution for me.

    I'm running a Hyperledger Fabric network with single peer and orderer. Their Docker containers have exposed the following ports. 7051:7051 & 7053:7053 on peer, 7050:7050 on orderer. I'm trying to configure Prometheus to analyse the metrics by following the official documentation .

    As mentioned in the documentation, I'm exposing my local machine's 9443 port to port 9443 of peer docker container by mapping it as 9443:9443 in ports section of docker-compose.yaml. When I run curl 0.0.0.0:9443, I get curl: (56) Recv failure: Connection reset by peer error.

    However, when I run the command curl 0.0.0.0:9443/logspec in my peer container I get the desired result which is {"spec":"info"}. The two commands mentioned above are different but I've also tried running the command curl 0.0.0.0:9443/logspec in my local machine to which I got the same error response.

    Running the command curl -v 0.0.0.0:9443 results in following response.

    * About to connect() to 0.0.0.0 port 9443 (#0)
    *   Trying 0.0.0.0...
    * Connected to 0.0.0.0 (0.0.0.0) port 9443 (#0)
    > GET / HTTP/1.1
    > User-Agent: curl/7.29.0
    > Host: 0.0.0.0:9443
    > Accept: */*
    >
    * Recv failure: Connection reset by peer
    * Closing connection 0
    curl: (56) Recv failure: Connection reset by peer
    

    I read in many of the answers that I might be a firewall issue. But even after disabling my firewall using the command systemctl disable firewalld, it's not working.

    cat etc/os-release response

    NAME="CentOS Linux"
    VERSION="7 (Core)"
    ID="centos"
    ID_LIKE="rhel fedora"
    VERSION_ID="7"
    PRETTY_NAME="CentOS Linux 7 (Core)"
    CPE_NAME="cpe:/o:centos:centos:7"
    HOME_URL="https://www.centos.org/"
    BUG_REPORT_URL="https://bugs.centos.org/"
    
    CENTOS_MANTISBT_PROJECT="CentOS-7"
    CENTOS_MANTISBT_PROJECT_VERSION="7"
    REDHAT_SUPPORT_PRODUCT="centos"
    REDHAT_SUPPORT_PRODUCT_VERSION="7"
    

    curl --version response

    curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.34 zlib/1.2.7 libidn/1.28 libssh2/1.4.3
    

    I request you not to mark this question as duplicate as I've already gone through all the possible scenarios mentioned here.

  • Kartik Chauhan
    Kartik Chauhan over 5 years
    Thanks, it worked. I didn't have to disable my firewall though.
  • Kartik Chauhan
    Kartik Chauhan over 5 years
    Changing listenAddress: :9443 to listenAddress: 0.0.0.0:9443 also worked.