windowsrustgithub-actionsrust-cargobuffer-overrun

GitHub build server fails with `STATUS_STACK_BUFFER_OVERRUN`


When the GitHub's continuous integration "workflow" runs my test suite on a windows-latest machine, it fails with the error memory allocation of 139280 bytes failed, STATUS_STACK_BUFFER_OVERRUN.

Full error message

test models::blockchain::transaction::validity::tasm::transaction_kernel_mast_hash::benches::get_transaction_kernel_field_benchmark ... memory allocation of 139280 bytes failed
error: test failed, to rerun pass `--lib`
Error: test failed, to rerun pass `--lib`
Caused by:
  process didn't exit successfully: `D:\a\neptune-core\neptune-core\target\debug\deps\neptune_core-0b14cb2984d9a2d2.exe --test-threads=1` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)
Error: The process 'C:\Users\runneradmin\.cargo\bin\cargo.exe' failed with exit code 3221226505

How can fix that?


Solution

  • The problem could be that your tests use too much RAM for GitHub's build machines. The Windows machines seem to have less RAM than the Ubuntu and MacOS machines. Try to run the tests one at a time like so: cargo test -- --test-thread=1 and see if you can identify which test that fails. Do this on GitHub's build machine.

    Once you have identified which test (or tests) that cause the problems, you can skip that test when its run on GitHub's build server by providing the argument skip, like so: cargo test -- --skip <expensive test>.

    Your .github/workflows/main.yml file might then have this step defined:

          - name: Run cargo test without <expensive test>
            uses: actions-rs/cargo@v1
            with:
              command: test
              args: -- --skip <expensive test>
    

    Admittedly it would be better if you only had to skip the test on Windows (or the OS where it fails) but I don't know how to do that through the main.yml file.