aptos-labs / aptos-core

Aptos is a layer 1 blockchain built to support the widespread use of blockchain through better technology and user experience.
https://aptosfoundation.org
Other
6.17k stars 3.64k forks source link

[Bug] Huge `.trace` file occurs after running tests/build many times (sometimes in parallel) #15054

Open Rqnsom opened 1 week ago

Rqnsom commented 1 week ago

πŸ› Bug

While performing many tests with the move-mutation-tool, I noticed the .trace file can grow a lot, from 800Mb to 56Gb. This caused me to run out of space a couple of times since our tool copies the package under test to a randomly generated folder in the /tmp/ directory. Not sure if this is normal, but it does seem strange.

To reproduce

I am not completely sure how to reproduce this yet, but I noticed this a few times (after my OS reported "low disk space" warnings).

Expected Behavior

The expected size should be much lower. For example, the other coverage file, .coverage_map.mvcov, has only 901Kb.

System information

$ aptos-framework git:(main) βœ— aptos -V
aptos 4.2.3
$ uname -moprsv
Darwin 24.0.0 Darwin Kernel Version 24.0.0: Tue Sep 24 23:37:13 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T8112 arm64 arm
$ ➜  aptos-framework git:(main) βœ— rustc -V
rustc 1.78.0 (9b00956e5 2024-04-29)

Additional context

I will post new info if I manage to reproduce it again - but I created a workaround in our tool to delete the .trace file: #56 feat: optimization - delete .trace file

brmataptos commented 6 days ago

I note that xz and bzip2 both seem to get >3000x compression on a sample .trace file. I wonder if we can use compress_ioto automatically compress and decompress the .trace file. I note that the trace file is created in third_party/move/move-vm/runtime/src/tracing.rs, the filename to write is set in third_party/move/tools/move-cli/src/base/test.rs (var trace_path, which is used to set env var MOVE_VM_TRACE), coverage map is computed from that trace file, specified also in tests.rs, but read in function CoverageMap::update_coverage_from_trace_file(), defined in third_party/move/tools/move-coverage/src/coverge_map.rs. Perhaps another library would be superior.