p2p-fullblocktest fails on BSD derivates #8605

issue laanwj opened this issue on August 26, 2016
  1. laanwj commented at 3:06 PM on August 26, 2016: member

    On OpenBSD:

    Initializing test directory /tmp/test8vty0436/25006
    MiniNode: Connecting to Bitcoin Node IP # 127.0.0.1:11408
    ...
    Unexpected exception caught during testing: error('cannot add item to database',)
      File "/home/user/bitcoin/qa/rpc-tests/test_framework/test_framework.py", line 150, in main
        self.run_test()
      File "qa/rpc-tests/p2p-fullblocktest.py", line 73, in run_test
        self.test.run()
      File "/home/user/bitcoin/qa/rpc-tests/test_framework/comptool.py", line 336, in run
        self.block_store.add_block(block)
      File "/home/user/bitcoin/qa/rpc-tests/test_framework/blockstore.py", line 80, in add_block
        self.blockDB[repr(block.sha256)] = bytes(block.serialize())
    Stopping nodes
    

    Could be a difference between ndb back-end libraries used on OpenBSD and Ubuntu. I vaguely remember some ndb variants can only handle fairly small databases.

    On Ubuntu:

    >>> import _dbm
    >>> _dbm.library
    'Berkeley DB'
    

    On OpenBSD:

    >>> import _dbm
    >>> _dbm.library                                                                                                                                                                               
    'GNU gdbm'
    

    I believe even that is misreporting: OpenBSD does not install gdbm by default. This must be some ancient dbm variant. Just checked: It's taking the symbol from the libc(!) off all places: https://github.com/robertbachmann/openbsd-libc/tree/master/db

    4.4BSD (and its derivatives such as NetBSD) contains Berkeley DB 1 in libc.

    Ugh.

    Anyhow, seems to work if I swap dbm.ndbm with dbm.dumb in test_framework/blockstore.py (be sure to replace all three occurences). This is not a good idea by default, as the performance of the dumb database is rumored to be abysmal (I haven't benchmarked though), but we could add a workaround specifically for OpenBSD.

    diff --git a/qa/rpc-tests/test_framework/blockstore.py b/qa/rpc-tests/test_framework/blockstore.py
    index 1e2bbb2..74cf125 100644
    --- a/qa/rpc-tests/test_framework/blockstore.py
    +++ b/qa/rpc-tests/test_framework/blockstore.py
    @@ -9,11 +9,11 @@
    
     from .mininode import *
     from io import BytesIO
    -import dbm.ndbm
    +import dbm.dumb
    
     class BlockStore(object):
         def __init__(self, datadir):
    -        self.blockDB = dbm.ndbm.open(datadir + "/blocks", 'c')
    +        self.blockDB = dbm.dumb.open(datadir + "/blocks", 'c')
             self.currentBlock = 0
             self.headers_map = dict()
    
    @@ -123,7 +123,7 @@ class BlockStore(object):
    
     class TxStore(object):
         def __init__(self, datadir):
    -        self.txDB = dbm.ndbm.open(datadir + "/transactions", 'c')
    +        self.txDB = dbm.dumb.open(datadir + "/transactions", 'c')
    
         def close(self):
             self.txDB.close()
    
  2. laanwj added the label Priority Low on Aug 26, 2016
  3. laanwj added the label Tests on Aug 26, 2016
  4. laanwj commented at 6:58 PM on September 28, 2016: member

    Apparently this is a problem on other BSD derivatives as well, but slightly different: On FreeBSD and OSX, the file grows to a huge size (>100GB) fills the disk and the same error happens.

  5. laanwj added the label MacOSX on Sep 28, 2016
  6. laanwj added the label Linux/Unix on Sep 28, 2016
  7. laanwj removed the label Priority Low on Sep 28, 2016
  8. laanwj renamed this:
    p2p-fullblocktest fails on OpenBSD (5.9)
    p2p-fullblocktest fails on BSD derivates
    on Sep 28, 2016
  9. pedrobranco commented at 9:50 PM on September 28, 2016: contributor

    I confirm the issue on OSX (+64GB).

  10. laanwj closed this on Sep 29, 2016

  11. MarcoFalke 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: 2026-04-13 15:15 UTC

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