Experiment: test: Disable fsync in travis tests #10220

pull laanwj wants to merge 7 commits into bitcoin:master from laanwj:2017_04_tests_eatmydata changing 2 files +7 −4
  1. laanwj commented at 9:20 AM on April 17, 2017: member

    Install the package "eatmydata" which disables fsync and friends, and use this while running the functional tests.

    Not sure whether it applies to travis, but at least locally on a VM this made some of the tests run three times as fast.

  2. test: Add elapsed time to RPC tracing 6c947d6d06
  3. test: Disable fsync in travis tests
    Install the package "eatmydata" which disables fsync and friends,
    and use this while running the functional tests.
    
    Not sure whether it applies to travis, but at least locally on a VM this
    made some of the tests run three times as fast.
    fea6569013
  4. laanwj added the label Tests on Apr 17, 2017
  5. in .travis.yml:35 in fea6569013 outdated
      34 |  # bitcoind
      35 | -    - HOST=x86_64-unknown-linux-gnu PACKAGES="bc python3-zmq" DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports CPPFLAGS=-DDEBUG_LOCKORDER"
      36 | +    - HOST=x86_64-unknown-linux-gnu PACKAGES="bc python3-zmq eatmydata" DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports CPPFLAGS=-DDEBUG_LOCKORDER"
      37 |  # No wallet
      38 | -    - HOST=x86_64-unknown-linux-gnu PACKAGES="python3 xvfb" DEP_OPTS="NO_WALLET=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports"
      39 | +    - HOST=x86_64-unknown-linux-gnu PACKAGES="python3 xvfb eatmydata" DEP_OPTS="NO_WALLET=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports"
    


    MarcoFalke commented at 9:34 AM on April 17, 2017:

    <strike> functional tests are disabled for windows and no_wallet, so I don't think we need this here.</strike>

    You probably did this for consistency/simpler code.


    laanwj commented at 10:40 AM on April 17, 2017:

    My intent was to add it for all the lines that have RUN_TESTS=true

  6. MarcoFalke commented at 10:16 AM on April 17, 2017: member

    <strike>Concept ACK:</strike>

    *** BEFORE ***
    ALL                            | ✓ Passed  | 2648 s (accumulated) 
    Runtime: 713 s
    
    *** AFTER ***
    ALL                            | ✓ Passed  | 1290 s (accumulated) 
    Runtime: 337 s
    

    As we ignore the return code of fsync in our code, this should not add additional debug hassle in case the fsync fails to write everything to disk (maybe due to hardware issues)?

    Edit: The comparison is wrong. I accidentally compared a CRON job against this pull request, where this pull runs a subset of the tests of a cron job.

  7. laanwj commented at 10:44 AM on April 17, 2017: member

    As we ignore the return code of fsync in our code, this should not add additional debug hassle in case the fsync fails to write everything to disk (maybe due to hardware issues)?

    I don't think so.

    It does remind me that we could use the same technique (library interposing) to inject failures for testing to test how bitcoind handles i/o failures.

  8. laanwj commented at 10:46 AM on April 17, 2017: member

    Argh, it fails on 32-bit linux:

    ERROR: ld.so: object '/usr/lib/libeatmydata/libeatmydata.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
    
  9. squashme: add 32-bit eatmydata lib 7a00030059
  10. retry (whole package as i386)
    Apparently on trusty there is no separate package for the library yet.
    4343249c9b
  11. squashme: dpkg arch i386 a7a8c1d66a
  12. laanwj commented at 1:49 PM on April 17, 2017: member

    I can't get it to work on 32-bit: not with 32-bit and not with 64-bit eatmydata.

    The problem, I think, is that python runs as 64-bit, and bitcoind as 32-bit. So with the 64-bit eatmydata it fails on bitcoind, with the 32-bit one it fails on python.

    Not sure what would be a good way to fix this. I suppose a hack that sets the environment variable BITCOIND so that only bitcoind is started through eatmydata (and not the outer script) could work.

    Edit: BITCOIND="eatmydata $PWD/src/bitcoind" doesn't work, at least. This would need an actual wrapper script.

  13. try with wrapper 042611dfeb
  14. laanwj commented at 2:37 PM on April 17, 2017: member

    Hm another idea, instead of using the wrapper/interposer, which seems to be tricky on mixed architctures, couldn't we just link bitcoind against libeatmydata.so directly? On Ubuntu 16.04 libeatmydata1 is a separate package that can be installed, this isn't the case on trusty/14.04.

    16.04 (just for illustration):

    $ dpkg -L libeatmydata1
    ...
    /usr/lib/x86_64-linux-gnu/libeatmydata.so.1.1.2
    /usr/lib/x86_64-linux-gnu/libeatmydata.so.1
    /usr/lib/x86_64-linux-gnu/libeatmydata.so
    

    14.04 (which is what travis uses):

    $ dpkg -L eatmydata
    ...
    /usr/lib/libeatmydata/libeatmydata.so
    
  15. laanwj commented at 7:16 PM on April 17, 2017: member

    With the wrapper most works, but it still fails in p2p-versionbits-warning.py, as this makes bitcoind invoke another process which apparently is 64 bit:

    p2p-versionbits-warning.py failed, Duration: 8 s
    stdout:
    2017-04-17 17:09:13.351000 TestFramework (INFO): Initializing test directory /tmp/testmahvm5qh/275
    2017-04-17 17:09:13.609000 TestFramework.mininode (INFO): Connecting to Bitcoin Node: 127.0.0.1:13200
    2017-04-17 17:09:19.543000 TestFramework (INFO): Stopping nodes
    2017-04-17 17:09:21.665000 TestFramework (INFO): Cleaning up
    2017-04-17 17:09:21.666000 TestFramework (INFO): Tests successful
    stderr:
    ERROR: ld.so: object '/usr/lib/libeatmydata/libeatmydata.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
    ERROR: ld.so: object '/usr/lib/libeatmydata/libeatmydata.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
    

    Sigh...

  16. jnewbery commented at 10:04 PM on April 17, 2017: member

    this makes bitcoind invoke another process

    The only process I can think of that p2p-versionbits-warning.py specifically would invoke is echo:

            self.extra_args = [["-alertnotify=echo %s >> \"" + self.alert_filename + "\""]]
    

    This causes bitcoind to launch a thread to run echo when it detects blocks signalling unknown versionbits.

  17. link against libeatmydata
    Get rid of the wrapper and link directly against the library instead.
    124f8754ae
  18. laanwj commented at 6:24 AM on April 18, 2017: member

    Hm another idea, instead of using the wrapper/interposer, which seems to be tricky on mixed architctures, couldn't we just link bitcoind against libeatmydata.so directly?

    I've tried this locally with some success, but not entirely sure how to port it to travis. Trying...

  19. laanwj commented at 12:33 PM on April 18, 2017: member

    Oh wow that worked.

    But seems @MarcoFalke 's comparison was mistaken and this doesn't actually make a difference so closing...

  20. laanwj closed this on Apr 18, 2017

  21. MarcoFalke commented at 2:04 PM on April 18, 2017: member

    @laanwj Sorry for my confirmation bias. On a first glance those numbers seemed perfectly plausible.

  22. laanwj commented at 2:13 PM on April 18, 2017: member

    Yes it would have been plausible; apparently Travis isn't using qemu/kvm or has already configured their VMs to not pass through fsync.

  23. DrahtBot locked this on Sep 8, 2021
Labels

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