importprunedfunds + removeprunedfunds + listtransactions can cause OOM #13078

issue jnewbery openend this issue on April 25, 2018
  1. jnewbery commented at 8:35 pm on April 25, 2018: member

    I hit this while refactoring the wallet functional tests to remove the ‘account’ API.

    To reproduce this, take the commit at https://github.com/bitcoin/bitcoin/pull/13075/commits/6f3b8657c8e6564112d519cc90fa9042fc4504c1 and run wallet_importprunedfunds.py. I’ve tried to pare that test down to a minimal failure scenario, but I haven’t been able to reliably reproduce this with a shorter test yet.

    What I know so far is that some combination of importprunedfunds, removeprunedfunds and listtransactions leads to the node OOM’ing. The failure occurs at line 107:

     0→ /wallet_importprunedfunds.py 
     12018-04-25T20:32:37.762000Z TestFramework (INFO): Initializing test directory /tmp/user/1000/testjke6yfkx
     22018-04-25T20:32:38.143000Z TestFramework (INFO): Mining blocks...
     3terminate called without an active exception
     42018-04-25T20:32:38.465000Z TestFramework (ERROR): Unexpected exception caught during testing
     5Traceback (most recent call last):
     6  File "/home/ubuntu/bitcoin/test/functional/test_framework/authproxy.py", line 107, in _request
     7    return self._get_response()
     8  File "/home/ubuntu/bitcoin/test/functional/test_framework/authproxy.py", line 153, in _get_response
     9    http_response = self.__conn.getresponse()
    10  File "/usr/lib/python3.5/http/client.py", line 1197, in getresponse
    11    response.begin()
    12  File "/usr/lib/python3.5/http/client.py", line 297, in begin
    13    version, status, reason = self._read_status()
    14  File "/usr/lib/python3.5/http/client.py", line 266, in _read_status
    15    raise RemoteDisconnected("Remote end closed connection without"
    16http.client.RemoteDisconnected: Remote end closed connection without response
    17
    18During handling of the above exception, another exception occurred:
    19
    20Traceback (most recent call last):
    21  File "/home/ubuntu/bitcoin/test/functional/test_framework/test_framework.py", line 147, in main
    22    self.run_test()
    23  File "./wallet_importprunedfunds.py", line 107, in run_test
    24    assert not [tx for tx in self.nodes[1].listtransactions(include_watchonly=True) if tx['txid'] == txnid2]
    25  File "/home/ubuntu/bitcoin/test/functional/test_framework/coverage.py", line 47, in __call__
    26    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
    27  File "/home/ubuntu/bitcoin/test/functional/test_framework/authproxy.py", line 136, in __call__
    28    response = self._request('POST', self.__url.path, postdata.encode('utf-8'))
    29  File "/home/ubuntu/bitcoin/test/functional/test_framework/authproxy.py", line 111, in _request
    30    self.__conn.request(method, path, postdata, headers)
    31  File "/usr/lib/python3.5/http/client.py", line 1106, in request
    32    self._send_request(method, url, body, headers)
    33  File "/usr/lib/python3.5/http/client.py", line 1151, in _send_request
    34    self.endheaders(body)
    35  File "/usr/lib/python3.5/http/client.py", line 1102, in endheaders
    36    self._send_output(message_body)
    37  File "/usr/lib/python3.5/http/client.py", line 934, in _send_output
    38    self.send(msg)
    39  File "/usr/lib/python3.5/http/client.py", line 877, in send
    40    self.connect()
    41  File "/usr/lib/python3.5/http/client.py", line 849, in connect
    42    (self.host,self.port), self.timeout, self.source_address)
    43  File "/usr/lib/python3.5/socket.py", line 711, in create_connection
    44    raise err
    45  File "/usr/lib/python3.5/socket.py", line 702, in create_connection
    46    sock.connect(sa)
    47ConnectionRefusedError: [Errno 111] Connection refused
    482018-04-25T20:32:38.473000Z TestFramework (INFO): Stopping nodes
    492018-04-25T20:32:38.475000Z TestFramework.node1 (ERROR): Unable to stop node.
    50Traceback (most recent call last):
    51  File "/home/ubuntu/bitcoin/test/functional/test_framework/test_node.py", line 187, in stop_node
    52    self.stop()
    53  File "/home/ubuntu/bitcoin/test/functional/test_framework/coverage.py", line 47, in __call__
    54    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
    55  File "/home/ubuntu/bitcoin/test/functional/test_framework/authproxy.py", line 136, in __call__
    56    response = self._request('POST', self.__url.path, postdata.encode('utf-8'))
    57  File "/home/ubuntu/bitcoin/test/functional/test_framework/authproxy.py", line 106, in _request
    58    self.__conn.request(method, path, postdata, headers)
    59  File "/usr/lib/python3.5/http/client.py", line 1106, in request
    60    self._send_request(method, url, body, headers)
    61  File "/usr/lib/python3.5/http/client.py", line 1141, in _send_request
    62    self.putrequest(method, url, **skips)
    63  File "/usr/lib/python3.5/http/client.py", line 974, in putrequest
    64    raise CannotSendRequest(self.__state)
    65http.client.CannotSendRequest: Request-sent
    66Traceback (most recent call last):
    67  File "./wallet_importprunedfunds.py", line 113, in <module>
    68    ImportPrunedFundsTest().main()
    69  File "/home/ubuntu/bitcoin/test/functional/test_framework/test_framework.py", line 170, in main
    70    self.stop_nodes()
    71  File "/home/ubuntu/bitcoin/test/functional/test_framework/test_framework.py", line 300, in stop_nodes
    72    node.wait_until_stopped()
    73  File "/home/ubuntu/bitcoin/test/functional/test_framework/test_node.py", line 214, in wait_until_stopped
    74    wait_until(self.is_node_stopped, timeout=timeout)
    75  File "/home/ubuntu/bitcoin/test/functional/test_framework/util.py", line 216, in wait_until
    76    if predicate():
    77  File "/home/ubuntu/bitcoin/test/functional/test_framework/test_node.py", line 205, in is_node_stopped
    78    "Node returned non-zero exit code (%d) when stopping" % return_code)
    79AssertionError: [node 1] Node returned non-zero exit code (-6) when stopping
    80[node 1] Cleaning up leftover process
    

    Tail of node1’s debug.log:

    02018-04-25T20:32:38.338225Z ThreadRPCServer method=removeprunedfunds user=__cookie__
    12018-04-25T20:32:38.339174Z Received a POST request for / from 127.0.0.1:34026
    22018-04-25T20:32:38.339214Z ThreadRPCServer method=listtransactions user=__cookie__
    32018-04-25T20:32:38.339348Z Error: Out of memory. Terminating.
    
  2. MarcoFalke commented at 2:10 am on April 26, 2018: member
    Potentially related: #9729 (haven’t looked)
  3. meshcollider added the label Resource usage on May 2, 2018
  4. MarcoFalke commented at 3:39 pm on June 18, 2018: member
    @jnewbery Is this still an issue with current master?
  5. MarcoFalke commented at 8:20 pm on June 18, 2018: member
    Potentially fixed by 0882406
  6. MarcoFalke closed this on Jun 18, 2018

  7. jnewbery commented at 8:45 pm on June 18, 2018: member
    Agree that this seems to be fixed in master. Thanks @MarcoFalke !
  8. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-22 06:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me