Repository: taiki-e/cargo-llvm-cov

Issue #128: Error in loading coverage data, on nightly-2022-01-15 or later
Created: 2022-01-17T05:24:55Z
Hey, we are using cargo-llvm-cov in our CI to get the coverage information, and for the last two days we are getting error saying failed to load the coverage information
info: when --target option is used, coverage for proc-macro and build script will not be displayed because cargo does not pass RUSTFLAGS to them
error: failed to generate report: process didn't exit successfully: `/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-cov export -format=lcov -instr-profile=/home/runner/work/youki/youki/target/llvm-cov-target/youki.profdata -object /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/integration_test-70ccadba5ff3eeb2 -object /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/integration_test-897d63685f9f06f0 -object /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/libcgroups-de8628be3307ab15 -object /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/libcontainer-69decfa1a73d5aab -object /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/liboci_cli-772485136e063db8 -object /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/libseccomp-c6eee5d114d66b56 -object /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/test_framework-672ff83324cabc04 -object /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/youki-894d6d4b690bb21f -ignore-filename-regex 'libseccomp/src|integration_test/src|test_framework/src|systemd_api.rs|(^|/)(rustc/[0-9a-f]+|tests|examples|benches|target/llvm-cov-target)/|^/home/runner($|/)|^/home/runner/.cargo($|/)|^/home/runner/.rustup($|/)'` (exit status: 1)
--- stderr
error: /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/integration_test-70ccadba5ff3eeb2, /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/integration_test-897d63685f9f06f0, /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/libcgroups-de8628be3307ab15, /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/libcontainer-69decfa1a73d5aab, /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/liboci_cli-772485136e063db8, /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/libseccomp-c6eee5d114d66b56, /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/test_framework-672ff83324cabc04, /home/runner/work/youki/youki/target/llvm-cov-target/x86_64-unknown-linux-gnu/debug/deps/youki-894d6d4b690bb21f: Failed to load coverage: Truncated coverage data
error: Could not load coverage information

Error: Process completed with exit code 1.


This is the exact error we are getting in our CI.
for reference, our CI yaml is https://github.com/containers/youki/blob/main/.github/workflows/main.yml#L68 and the PR where the CI is failing is https://github.com/containers/youki/runs/4832086318?check_suite_focus=true
The reason I suspect this is due to an error in nightly is that the same CI worked about 3 days ago, here https://github.com/containers/youki/runs/4817746220?check_suite_focus=true
To make sure it is not due to changes made in the PR, I tried puling the PR and running the steps for coverage manually with nightly version about ~1 month old, which generated coverage without any error. Then after updating rust using rustup on 16 Jan 2022 (yesterday) I got the exact same error on my local as well.
Can you please confirm that this is indeed some issue with nightly and not some accidental breakage from our side? And if so should I open an issue on rust repo?
Thanks for the help :)

Duplicate issue #134: Generation fails due to "Truncated coverage data" 
Created: 2022-02-07T04:09:36Z
Have been using cargo-llvm-cov successfully in the past several times, and it just worked great. But recently it always fails with the error Failed to load coverage: Truncated coverage data.
Could this be some change that happened in the llvm-tools-preview package on nightly?
OS: MacOS
Project: dnaka91/obws
Rustc Version: rustc 1.60.0-nightly (f624427f8 2022-02-06)
This is the full error output:
error: target/llvm-cov-target/debug/build/anyhow-0deaec97327e4671/build-script-build, target/llvm-cov-target/debug/build/anyhow-0deaec97327e4671/build_script_build-0deaec97327e4671, target/llvm-cov-target/debug/build/anyhow-11757e37879e3e70/build-script-build, target/llvm-cov-target/debug/build/anyhow-11757e37879e3e70/build_script_build-11757e37879e3e70, target/llvm-cov-target/debug/build/futures-core-3a9d5930b2a841b2/build-script-build, target/llvm-cov-target/debug/build/futures-core-3a9d5930b2a841b2/build_script_build-3a9d5930b2a841b2, target/llvm-cov-target/debug/build/futures-core-3ddbaa07089d082d/build-script-build, target/llvm-cov-target/debug/build/futures-core-3ddbaa07089d082d/build_script_build-3ddbaa07089d082d, target/llvm-cov-target/debug/build/futures-task-109a30ae9b891e7b/build-script-build, target/llvm-cov-target/debug/build/futures-task-109a30ae9b891e7b/build_script_build-109a30ae9b891e7b, target/llvm-cov-target/debug/build/futures-task-1ab505591ec822c2/build-script-build, target/llvm-cov-target/debug/build/futures-task-1ab505591ec822c2/build_script_build-1ab505591ec822c2, target/llvm-cov-target/debug/build/futures-util-8faf909b5fb0152b/build-script-build, target/llvm-cov-target/debug/build/futures-util-8faf909b5fb0152b/build_script_build-8faf909b5fb0152b, target/llvm-cov-target/debug/build/futures-util-d399d88abf0e45cb/build-script-build, target/llvm-cov-target/debug/build/futures-util-d399d88abf0e45cb/build_script_build-d399d88abf0e45cb, target/llvm-cov-target/debug/build/generic-array-f6893c66a2b6ed4e/build-script-build, target/llvm-cov-target/debug/build/generic-array-f6893c66a2b6ed4e/build_script_build-f6893c66a2b6ed4e, target/llvm-cov-target/debug/build/httparse-c875addf0a93043d/build-script-build, target/llvm-cov-target/debug/build/httparse-c875addf0a93043d/build_script_build-c875addf0a93043d, target/llvm-cov-target/debug/build/libc-64dc221bb1a997ba/build-script-build, target/llvm-cov-target/debug/build/libc-64dc221bb1a997ba/build_script_build-64dc221bb1a997ba, target/llvm-cov-target/debug/build/libc-ab5a7f10f2043aab/build-script-build, target/llvm-cov-target/debug/build/libc-ab5a7f10f2043aab/build_script_build-ab5a7f10f2043aab, target/llvm-cov-target/debug/build/log-7aeff1f4899b7e98/build-script-build, target/llvm-cov-target/debug/build/log-7aeff1f4899b7e98/build_script_build-7aeff1f4899b7e98, target/llvm-cov-target/debug/build/memchr-befa59ac0d13a638/build-script-build, target/llvm-cov-target/debug/build/memchr-befa59ac0d13a638/build_script_build-befa59ac0d13a638, target/llvm-cov-target/debug/build/proc-macro2-12a08702f33cb4fd/build-script-build, target/llvm-cov-target/debug/build/proc-macro2-12a08702f33cb4fd/build_script_build-12a08702f33cb4fd, target/llvm-cov-target/debug/build/ring-4426400e214b13a0/build-script-build, target/llvm-cov-target/debug/build/ring-4426400e214b13a0/build_script_build-4426400e214b13a0, target/llvm-cov-target/debug/build/rustversion-0fcd536110f8cbf5/build-script-build, target/llvm-cov-target/debug/build/rustversion-0fcd536110f8cbf5/build_script_build-0fcd536110f8cbf5, target/llvm-cov-target/debug/build/semver-da5111e14fb7e53c/build-script-build, target/llvm-cov-target/debug/build/semver-da5111e14fb7e53c/build_script_build-da5111e14fb7e53c, target/llvm-cov-target/debug/build/semver-f147641bca290af3/build-script-build, target/llvm-cov-target/debug/build/semver-f147641bca290af3/build_script_build-f147641bca290af3, target/llvm-cov-target/debug/build/serde-7c630a0a879b3265/build-script-build, target/llvm-cov-target/debug/build/serde-7c630a0a879b3265/build_script_build-7c630a0a879b3265, target/llvm-cov-target/debug/build/serde-f9a70554b5c2b166/build-script-build, target/llvm-cov-target/debug/build/serde-f9a70554b5c2b166/build_script_build-f9a70554b5c2b166, target/llvm-cov-target/debug/build/serde_derive-2fbf478fecf7f47c/build-script-build, target/llvm-cov-target/debug/build/serde_derive-2fbf478fecf7f47c/build_script_build-2fbf478fecf7f47c, target/llvm-cov-target/debug/build/serde_derive-652ad15766278389/build-script-build, target/llvm-cov-target/debug/build/serde_derive-652ad15766278389/build_script_build-652ad15766278389, target/llvm-cov-target/debug/build/serde_json-966e673159dffa2a/build-script-build, target/llvm-cov-target/debug/build/serde_json-966e673159dffa2a/build_script_build-966e673159dffa2a, target/llvm-cov-target/debug/build/serde_json-f11470691e35515d/build-script-build, target/llvm-cov-target/debug/build/serde_json-f11470691e35515d/build_script_build-f11470691e35515d, target/llvm-cov-target/debug/build/serde_test-e21ca3889a7d1d00/build-script-build, target/llvm-cov-target/debug/build/serde_test-e21ca3889a7d1d00/build_script_build-e21ca3889a7d1d00, target/llvm-cov-target/debug/build/syn-00528ab57a5b399e/build-script-build, target/llvm-cov-target/debug/build/syn-00528ab57a5b399e/build_script_build-00528ab57a5b399e, target/llvm-cov-target/debug/build/syn-0b3cfe976b16a760/build-script-build, target/llvm-cov-target/debug/build/syn-0b3cfe976b16a760/build_script_build-0b3cfe976b16a760, target/llvm-cov-target/debug/build/typenum-b8ba57cb29bde287/build-script-main, target/llvm-cov-target/debug/build/typenum-b8ba57cb29bde287/build_script_main-b8ba57cb29bde287, target/llvm-cov-target/debug/deps/integration-3880f5b35cdcdbb2, target/llvm-cov-target/debug/deps/libasync_stream_impl-7bfb5b31af2a1a31.dylib, target/llvm-cov-target/debug/deps/libasync_stream_impl-8518d962c7f54acb.dylib, target/llvm-cov-target/debug/deps/libdarling_macro-7dc4982565f38e09.dylib, target/llvm-cov-target/debug/deps/libdarling_macro-8a8ebc326d2939cb.dylib, target/llvm-cov-target/debug/deps/libfutures_macro-7f174fc4124dbe57.dylib, target/llvm-cov-target/debug/deps/libfutures_macro-c652c3db5803fbea.dylib, target/llvm-cov-target/debug/deps/librustversion-66ee14ca3f11122e.dylib, target/llvm-cov-target/debug/deps/libserde_derive-1eed428c3ed71456.dylib, target/llvm-cov-target/debug/deps/libserde_derive-520e96e0545235ad.dylib, target/llvm-cov-target/debug/deps/libserde_repr-e55860a3ca1bce92.dylib, target/llvm-cov-target/debug/deps/libserde_repr-feaf066ef92ebba6.dylib, target/llvm-cov-target/debug/deps/libserde_with_macros-7a6f60b3f82f2a2d.dylib, target/llvm-cov-target/debug/deps/libserde_with_macros-cea2c2d0e3cbe043.dylib, target/llvm-cov-target/debug/deps/libthiserror_impl-252e3bf731fff8d2.dylib, target/llvm-cov-target/debug/deps/libthiserror_impl-b3037b7568fb3134.dylib, target/llvm-cov-target/debug/deps/libtokio_macros-46e476d1c00fb151.dylib, target/llvm-cov-target/debug/deps/libtokio_macros-ed658ef8ab058d52.dylib, target/llvm-cov-target/debug/deps/libtracing_attributes-9f400b99e42d2fe4.dylib, target/llvm-cov-target/debug/deps/libtracing_attributes-bfc2d791dbec8257.dylib, target/llvm-cov-target/debug/deps/obws-4b642cab3c4c801b: Failed to load coverage: Truncated coverage data
error: failed to generate report: process didn't exit successfully: `/Users/dnaka91/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/llvm-cov report -instr-profile=/Users/dnaka91/Projects/public/obws/target/llvm-cov-target/obws.profdata -object target/llvm-cov-target/debug/build/anyhow-0deaec97327e4671/build-script-build -object target/llvm-cov-target/debug/build/anyhow-0deaec97327e4671/build_script_build-0deaec97327e4671 -object target/llvm-cov-target/debug/build/anyhow-11757e37879e3e70/build-script-build -object target/llvm-cov-target/debug/build/anyhow-11757e37879e3e70/build_script_build-11757e37879e3e70 -object target/llvm-cov-target/debug/build/futures-core-3a9d5930b2a841b2/build-script-build -object target/llvm-cov-target/debug/build/futures-core-3a9d5930b2a841b2/build_script_build-3a9d5930b2a841b2 -object target/llvm-cov-target/debug/build/futures-core-3ddbaa07089d082d/build-script-build -object target/llvm-cov-target/debug/build/futures-core-3ddbaa07089d082d/build_script_build-3ddbaa07089d082d -object target/llvm-cov-target/debug/build/futures-task-109a30ae9b891e7b/build-script-build -object target/llvm-cov-target/debug/build/futures-task-109a30ae9b891e7b/build_script_build-109a30ae9b891e7b -object target/llvm-cov-target/debug/build/futures-task-1ab505591ec822c2/build-script-build -object target/llvm-cov-target/debug/build/futures-task-1ab505591ec822c2/build_script_build-1ab505591ec822c2 -object target/llvm-cov-target/debug/build/futures-util-8faf909b5fb0152b/build-script-build -object target/llvm-cov-target/debug/build/futures-util-8faf909b5fb0152b/build_script_build-8faf909b5fb0152b -object target/llvm-cov-target/debug/build/futures-util-d399d88abf0e45cb/build-script-build -object target/llvm-cov-target/debug/build/futures-util-d399d88abf0e45cb/build_script_build-d399d88abf0e45cb -object target/llvm-cov-target/debug/build/generic-array-f6893c66a2b6ed4e/build-script-build -object target/llvm-cov-target/debug/build/generic-array-f6893c66a2b6ed4e/build_script_build-f6893c66a2b6ed4e -object target/llvm-cov-target/debug/build/httparse-c875addf0a93043d/build-script-build -object target/llvm-cov-target/debug/build/httparse-c875addf0a93043d/build_script_build-c875addf0a93043d -object target/llvm-cov-target/debug/build/libc-64dc221bb1a997ba/build-script-build -object target/llvm-cov-target/debug/build/libc-64dc221bb1a997ba/build_script_build-64dc221bb1a997ba -object target/llvm-cov-target/debug/build/libc-ab5a7f10f2043aab/build-script-build -object target/llvm-cov-target/debug/build/libc-ab5a7f10f2043aab/build_script_build-ab5a7f10f2043aab -object target/llvm-cov-target/debug/build/log-7aeff1f4899b7e98/build-script-build -object target/llvm-cov-target/debug/build/log-7aeff1f4899b7e98/build_script_build-7aeff1f4899b7e98 -object target/llvm-cov-target/debug/build/memchr-befa59ac0d13a638/build-script-build -object target/llvm-cov-target/debug/build/memchr-befa59ac0d13a638/build_script_build-befa59ac0d13a638 -object target/llvm-cov-target/debug/build/proc-macro2-12a08702f33cb4fd/build-script-build -object target/llvm-cov-target/debug/build/proc-macro2-12a08702f33cb4fd/build_script_build-12a08702f33cb4fd -object target/llvm-cov-target/debug/build/ring-4426400e214b13a0/build-script-build -object target/llvm-cov-target/debug/build/ring-4426400e214b13a0/build_script_build-4426400e214b13a0 -object target/llvm-cov-target/debug/build/rustversion-0fcd536110f8cbf5/build-script-build -object target/llvm-cov-target/debug/build/rustversion-0fcd536110f8cbf5/build_script_build-0fcd536110f8cbf5 -object target/llvm-cov-target/debug/build/semver-da5111e14fb7e53c/build-script-build -object target/llvm-cov-target/debug/build/semver-da5111e14fb7e53c/build_script_build-da5111e14fb7e53c -object target/llvm-cov-target/debug/build/semver-f147641bca290af3/build-script-build -object target/llvm-cov-target/debug/build/semver-f147641bca290af3/build_script_build-f147641bca290af3 -object target/llvm-cov-target/debug/build/serde-7c630a0a879b3265/build-script-build -object target/llvm-cov-target/debug/build/serde-7c630a0a879b3265/build_script_build-7c630a0a879b3265 -object target/llvm-cov-target/debug/build/serde-f9a70554b5c2b166/build-script-build -object target/llvm-cov-target/debug/build/serde-f9a70554b5c2b166/build_script_build-f9a70554b5c2b166 -object target/llvm-cov-target/debug/build/serde_derive-2fbf478fecf7f47c/build-script-build -object target/llvm-cov-target/debug/build/serde_derive-2fbf478fecf7f47c/build_script_build-2fbf478fecf7f47c -object target/llvm-cov-target/debug/build/serde_derive-652ad15766278389/build-script-build -object target/llvm-cov-target/debug/build/serde_derive-652ad15766278389/build_script_build-652ad15766278389 -object target/llvm-cov-target/debug/build/serde_json-966e673159dffa2a/build-script-build -object target/llvm-cov-target/debug/build/serde_json-966e673159dffa2a/build_script_build-966e673159dffa2a -object target/llvm-cov-target/debug/build/serde_json-f11470691e35515d/build-script-build -object target/llvm-cov-target/debug/build/serde_json-f11470691e35515d/build_script_build-f11470691e35515d -object target/llvm-cov-target/debug/build/serde_test-e21ca3889a7d1d00/build-script-build -object target/llvm-cov-target/debug/build/serde_test-e21ca3889a7d1d00/build_script_build-e21ca3889a7d1d00 -object target/llvm-cov-target/debug/build/syn-00528ab57a5b399e/build-script-build -object target/llvm-cov-target/debug/build/syn-00528ab57a5b399e/build_script_build-00528ab57a5b399e -object target/llvm-cov-target/debug/build/syn-0b3cfe976b16a760/build-script-build -object target/llvm-cov-target/debug/build/syn-0b3cfe976b16a760/build_script_build-0b3cfe976b16a760 -object target/llvm-cov-target/debug/build/typenum-b8ba57cb29bde287/build-script-main -object target/llvm-cov-target/debug/build/typenum-b8ba57cb29bde287/build_script_main-b8ba57cb29bde287 -object target/llvm-cov-target/debug/deps/integration-3880f5b35cdcdbb2 -object target/llvm-cov-target/debug/deps/libasync_stream_impl-7bfb5b31af2a1a31.dylib -object target/llvm-cov-target/debug/deps/libasync_stream_impl-8518d962c7f54acb.dylib -object target/llvm-cov-target/debug/deps/libdarling_macro-7dc4982565f38e09.dylib -object target/llvm-cov-target/debug/deps/libdarling_macro-8a8ebc326d2939cb.dylib -object target/llvm-cov-target/debug/deps/libfutures_macro-7f174fc4124dbe57.dylib -object target/llvm-cov-target/debug/deps/libfutures_macro-c652c3db5803fbea.dylib -object target/llvm-cov-target/debug/deps/librustversion-66ee14ca3f11122e.dylib -object target/llvm-cov-target/debug/deps/libserde_derive-1eed428c3ed71456.dylib -object target/llvm-cov-target/debug/deps/libserde_derive-520e96e0545235ad.dylib -object target/llvm-cov-target/debug/deps/libserde_repr-e55860a3ca1bce92.dylib -object target/llvm-cov-target/debug/deps/libserde_repr-feaf066ef92ebba6.dylib -object target/llvm-cov-target/debug/deps/libserde_with_macros-7a6f60b3f82f2a2d.dylib -object target/llvm-cov-target/debug/deps/libserde_with_macros-cea2c2d0e3cbe043.dylib -object target/llvm-cov-target/debug/deps/libthiserror_impl-252e3bf731fff8d2.dylib -object target/llvm-cov-target/debug/deps/libthiserror_impl-b3037b7568fb3134.dylib -object target/llvm-cov-target/debug/deps/libtokio_macros-46e476d1c00fb151.dylib -object target/llvm-cov-target/debug/deps/libtokio_macros-ed658ef8ab058d52.dylib -object target/llvm-cov-target/debug/deps/libtracing_attributes-9f400b99e42d2fe4.dylib -object target/llvm-cov-target/debug/deps/libtracing_attributes-bfc2d791dbec8257.dylib -object target/llvm-cov-target/debug/deps/obws-4b642cab3c4c801b -ignore-filename-regex '(^|/)(rustc/[0-9a-f]+|tests|examples|benches|target/llvm-cov-target)/|^/Users/dnaka91($|/)|^/Users/dnaka91/.cargo($|/)|^/Users/dnaka91/.rustup($|/)'` (exit status: 1)

Closing comment (2022-02-07T05:04:47Z): The error message seems to be similar to #128 fixed in nightly-2022-01-26.

What command did you run? What Rust-related environment variables did you set?
Looking at dnaka91/obws's Justfile, it looks like you had pinned the rustc version. Could you check if the same problem occurs when you explicitly use +nightly?
It is possible that our heuristics missed something, so removing the build artifacts may fix the problem.

(The integration test failed due to a connection error to the obs-websocket plugin, so I ran only the unit tests (cargo llvm-cov -v --lcov --all-features --lib), but could not reproduce the problem in nightly-2022-02-07.)