Skip to content

RPC broken on some IPv6 machines #1819

Closed

Description

@gavinandresen

Report from the forums: https://bitcointalk.org/index.php?topic=106236.msg1175793#msg1175793

09/09/12 23:28:43 ThreadMessageHandler started
09/09/12 23:28:43 ThreadOpenConnections started
09/09/12 23:28:43 trying connection xxxx lastseen=0.0hrs
09/09/12 23:28:43 ThreadOpenAddedConnections started
09/09/12 23:28:43 ThreadOpenAddedConnections exited
09/09/12 23:28:43 ThreadSocketHandler started
09/09/12 23:28:43 ThreadIRCSeed exited
09/09/12 23:28:43 Error: An error occurred while setting up the RPC port 8332 for listening: Address family not supported by protocol
09/09/12 23:28:43 ThreadRPCServer exited
09/09/12 23:28:43 Flush(false)
09/09/12 23:28:43 blkindex.dat refcount=0
09/09/12 23:28:43 blkindex.dat checkpoint
09/09/12 23:28:43 connected xxxx
09/09/12 23:28:43 send version message: version 60002, blocks=183152, us=0.0.0.0:0, them=xxxx:8333, peer=xxxx:8333
09/09/12 23:28:43 ThreadSocketHandler exited
09/09/12 23:28:43 ThreadMessageHandler exited

to make it work, one must comment out or remove the following in bitcoinrpc.cpp:

    acceptor->open(endpoint.protocol());
    acceptor->set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));

    // Try making the socket dual IPv6/IPv4 (if listening on the "any" address)
    boost::system::error_code v6_only_error;
    acceptor->set_option(boost::asio::ip::v6_only(loopback), v6_only_error);

    acceptor->bind(endpoint);
    acceptor->listen(socket_base::max_connections);

    RPCListen(acceptor, context, fUseSSL);
    // Cancel outstanding listen-requests for this acceptor when shutting down
    StopRequests.connect(signals2::slot<void ()>(
                static_cast<void (ip::tcp::acceptor::*)()>(&ip::tcp::acceptor::close), acceptor.get())
            .track(acceptor));

    // If dual IPv6/IPv4 failed (or we're opening loopback interfaces only), open IPv4 separately
    if (loopback || v6_only_error)

then it does:

09/10/12 00:00:22 ThreadMessageHandler started
09/10/12 00:00:22 ThreadOpenConnections started
09/10/12 00:00:22 trying connection xxxx lastseen=0.0hrs
09/10/12 00:00:22 ThreadOpenAddedConnections started
09/10/12 00:00:22 ThreadOpenAddedConnections exited
09/10/12 00:00:22 ThreadSocketHandler started
09/10/12 00:00:22 ThreadIRCSeed exited
09/10/12 00:00:22 connected xxxx
09/10/12 00:00:22 send version message: version 60002, blocks=183152, us=0.0.0.0:0, them=xxxx:8333, peer=xxxx:8333
09/10/12 00:00:22 Added time data, samples 2, offset -1 (+0 minutes)
09/10/12 00:00:22 Flushed 0 addresses to peers.dat 57ms
09/10/12 00:00:22 receive version message: version 60002, blocks=198073, us=xxxx:44586, them=xxxx:8333, peer=xxxx:8333
09/10/12 00:00:23 received block 0000000000000045a7f8 from xxxx:8333
09/10/12 00:00:23 SetBestChain: new best=0000000000000045a7f8 height=183153 work=345239274296880467532 date=06/05/12 18:48:15
09/10/12 00:00:23 ProcessBlock: ACCEPTED

and so on

Activity

  1. added a commit that references this issue on Sep 12, 2012
  2. laanwj commented on Sep 14, 2012

    @laanwj
    Member

    This has been fixed, closing

  3. added a commit that references this issue on Dec 5, 2020
  4. locked as resolved and limited conversation to collaborators on Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions