Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Some problems in the compilation process #740

Open
bbnolauv opened this issue Sep 14, 2024 · 2 comments
Open

Bug: Some problems in the compilation process #740

bbnolauv opened this issue Sep 14, 2024 · 2 comments
Labels
bug Something isn't working (correctness). Mark issues with this. deferred This issue is documented here and someone might want to fix it later, but it takes no priority infrastructure Infrastructure related issues or changes (CMake, dependencies, CI)

Comments

@bbnolauv
Copy link

Problem

➜  build git:(p0) ✗ make -j$(nproc) hyperloglog_test
[  9%] Built target bustub_optimizer
[ 11%] Built target gtest
[ 12%] Built target bustub_murmur3
[ 18%] Built target duckdb_pg_query
[ 20%] Built target fort
[ 22%] Built target fmt
[ 25%] Built target bustub_statement
[ 31%] Built target bustub_binder
[ 35%] Built target bustub_buffer
[ 37%] Built target bustub_catalog
[ 38%] Built target bustub_common
[ 40%] Built target bustub_concurrency
[ 42%] Built target bustub_recovery
[ 44%] Built target bustub_storage_disk
[ 46%] Built target bustub_container_disk_hash
[ 62%] Built target bustub_execution
[ 70%] Built target bustub_storage_page
[ 74%] Built target bustub_storage_table
[ 75%] Built target bustub_storage_index
[ 85%] Built target bustub_type
[ 88%] Built target bustub_primer
[ 94%] Built target bustub_planner
[ 94%] Built target gmock
[ 96%] Built target bustub
[ 98%] Built target gmock_main
[ 98%] Linking CXX executable hyperloglog_test
FATAL: ThreadSanitizer: unexpected memory mapping 0x56d9b16e7000-0x56d9b1717000
CMake Error at /usr/share/cmake-3.22/Modules/GoogleTestAddTests.cmake:83 (message):
  Error running test executable.

    Path: '/home/foo/Codes/bustub-private/build/test/hyperloglog_test'
    Result: 66
    Output:
      

Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/GoogleTestAddTests.cmake:179 (gtest_discover_tests_impl)


make[3]: *** [test/CMakeFiles/hyperloglog_test.dir/build.make:124: test/hyperloglog_test] Error 1
make[3]: *** Deleting file 'test/hyperloglog_test'
make[2]: *** [CMakeFiles/Makefile2:2958: test/CMakeFiles/hyperloglog_test.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:2965: test/CMakeFiles/hyperloglog_test.dir/rule] Error 2
make: *** [Makefile:1005: hyperloglog_test] Error 2

Steps to Reproduce the Problem

  1. clone the repo and run build_support/packages.sh
  2. cmake -DCMAKE_BUILD_TYPE=Debug -DBUSTUB_SANITIZER=thread -Bbuild && cmake --build build
  3. cd build && make -j$(nproc) hyperloglog_test

Specifications

  • Version:
    • clang version 14.0.0-1ubuntu1.1
    • cmake version 3.22.1
  • Platform: #40~22.04.3-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 30 17:30:19 UTC 2
@bbnolauv
Copy link
Author

bbnolauv commented Sep 14, 2024

Another problem

When I use the Debug default sanitizer (AddressSanitizer), I encounter some relatively hard to reproduce problems. It occurs intermittently.

cmake -DCMAKE_BUILD_TYPE=Debug -Bbuild && cmake --build build
➜  build git:(p0) ✗ make -j$(nproc) hyperloglog_test
Consolidate compiler generated dependencies of target gtest
Consolidate compiler generated dependencies of target bustub_murmur3
Consolidate compiler generated dependencies of target bustub_optimizer
Consolidate compiler generated dependencies of target duckdb_pg_query
[  0%] Built target bustub_murmur3
[  1%] Built target gtest
[  9%] Built target duckdb_pg_query
Consolidate compiler generated dependencies of target fmt
Consolidate compiler generated dependencies of target fort
Consolidate compiler generated dependencies of target bustub_binder
[ 11%] Built target fort
[ 20%] Built target bustub_optimizer
[ 22%] Built target fmt
Consolidate compiler generated dependencies of target bustub_buffer
Consolidate compiler generated dependencies of target bustub_statement
Consolidate compiler generated dependencies of target bustub_catalog
[ 27%] Built target bustub_binder
[ 31%] Built target bustub_buffer
[ 33%] Built target bustub_catalog
[ 37%] Built target bustub_statement
Consolidate compiler generated dependencies of target bustub_common
Consolidate compiler generated dependencies of target bustub_container_disk_hash
Consolidate compiler generated dependencies of target bustub_concurrency
Consolidate compiler generated dependencies of target bustub_execution
[ 38%] Built target bustub_container_disk_hash
[ 40%] Built target bustub_concurrency
[ 42%] Built target bustub_common
Consolidate compiler generated dependencies of target bustub_recovery
Consolidate compiler generated dependencies of target bustub_storage_disk
Consolidate compiler generated dependencies of target bustub_storage_index
[ 44%] Built target bustub_recovery
[ 46%] Built target bustub_storage_disk
[ 50%] Built target bustub_storage_index
[ 66%] Built target bustub_execution
Consolidate compiler generated dependencies of target bustub_storage_page
Consolidate compiler generated dependencies of target bustub_storage_table
Consolidate compiler generated dependencies of target bustub_type
Consolidate compiler generated dependencies of target bustub_planner
[ 68%] Built target bustub_storage_table
[ 75%] Built target bustub_storage_page
Consolidate compiler generated dependencies of target bustub_primer
[ 85%] Built target bustub_type
[ 90%] Built target bustub_planner
Consolidate compiler generated dependencies of target gmock
[ 94%] Built target bustub_primer
[ 94%] Built target gmock
Consolidate compiler generated dependencies of target gmock_main
[ 96%] Built target bustub
[ 98%] Built target gmock_main
[100%] Building CXX object test/CMakeFiles/hyperloglog_test.dir/primer/hyperloglog_test.cpp.o
[100%] Building CXX object test/CMakeFiles/hyperloglog_test.dir/__/tools/backtrace.cpp.o
[100%] Linking CXX executable hyperloglog_test
CMake Error at /usr/share/cmake-3.22/Modules/GoogleTestAddTests.cmake:83 (message):
  Error running test executable.

    Path: '/home/foo/Codes/bustub-private/build/test/hyperloglog_test'
    Result: Segmentation fault
    Output:
      

Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/GoogleTestAddTests.cmake:179 (gtest_discover_tests_impl)


make[3]: *** [test/CMakeFiles/hyperloglog_test.dir/build.make:124: test/hyperloglog_test] Error 1
make[3]: *** Deleting file 'test/hyperloglog_test'
make[2]: *** [CMakeFiles/Makefile2:2958: test/CMakeFiles/hyperloglog_test.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:2965: test/CMakeFiles/hyperloglog_test.dir/rule] Error 2
make: *** [Makefile:1005: hyperloglog_test] Error 2

When I execute the make command again, it may succeed. But when I run the executable, a segmentation fault occurs intermittently.

➜  build git:(p0) ✗ ./test/hyperloglog_test
[1]    3296 segmentation fault  ./test/hyperloglog_test
➜  build git:(p0) ✗ ./test/hyperloglog_test
Running main() from gmock_main.cc
[==========] Running 10 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 10 tests from HyperLogLogTest
[ RUN      ] HyperLogLogTest.BasicTest1
[       OK ] HyperLogLogTest.BasicTest1 (0 ms)
[ RUN      ] HyperLogLogTest.BasicTest2
[       OK ] HyperLogLogTest.BasicTest2 (0 ms)
[ RUN      ] HyperLogLogTest.EdgeTest1
[       OK ] HyperLogLogTest.EdgeTest1 (0 ms)
[ RUN      ] HyperLogLogTest.EdgeTest2
[       OK ] HyperLogLogTest.EdgeTest2 (0 ms)
[ RUN      ] HyperLogLogTest.BasicParallelTest
[       OK ] HyperLogLogTest.BasicParallelTest (45 ms)
[ RUN      ] HyperLogLogTest.ParallelTest1
[       OK ] HyperLogLogTest.ParallelTest1 (4550 ms)
[ RUN      ] HyperLogLogTest.PrestoBasicTest1
[       OK ] HyperLogLogTest.PrestoBasicTest1 (0 ms)
[ RUN      ] HyperLogLogTest.PrestoCase1
[       OK ] HyperLogLogTest.PrestoCase1 (0 ms)
[ RUN      ] HyperLogLogTest.PrestoCase2
[       OK ] HyperLogLogTest.PrestoCase2 (0 ms)
[ RUN      ] HyperLogLogTest.PrestoEdgeCase
[       OK ] HyperLogLogTest.PrestoEdgeCase (0 ms)
[----------] 10 tests from HyperLogLogTest (4597 ms total)

[----------] Global test environment tear-down
[==========] 10 tests from 1 test suite ran. (4597 ms total)
[  PASSED  ] 10 tests.

I tried to debug it using gdb but didn't find any useful information that I could understand.

[Thread 0x7fe2aa600640 (LWP 27559) exited]
[Thread 0x7fe2a9c00640 (LWP 27560) exited]
[Thread 0x7fe2a9200640 (LWP 27561) exited]
[       OK ] HyperLogLogTest.ParallelTest1 (6956 ms)
[ RUN      ] HyperLogLogTest.PrestoBasicTest1
[       OK ] HyperLogLogTest.PrestoBasicTest1 (0 ms)
[ RUN      ] HyperLogLogTest.PrestoCase1
[       OK ] HyperLogLogTest.PrestoCase1 (0 ms)
[ RUN      ] HyperLogLogTest.PrestoCase2
[       OK ] HyperLogLogTest.PrestoCase2 (0 ms)
[ RUN      ] HyperLogLogTest.PrestoEdgeCase
[       OK ] HyperLogLogTest.PrestoEdgeCase (0 ms)
[----------] 10 tests from HyperLogLogTest (7018 ms total)

[----------] Global test environment tear-down
[==========] 10 tests from 1 test suite ran. (7018 ms total)
[  PASSED  ] 10 tests.
==15449==LeakSanitizer has encountered a fatal error.
==15449==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
==15449==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
[Inferior 1 (process 15449) exited with code 01]
(gdb) bt
No stack.
(gdb) 

I guess this might be related to multithreading, something like a "data race"? But of course, it's just a guess; I still don't know the actual cause.

@connortsui20
Copy link
Member

I also run into this (as a TA) and my solution is to just rerun things until it stops happening. Of course, this is not a long term solution, so once us as a staff have more time we will take a look into this.

@connortsui20 connortsui20 added bug Something isn't working (correctness). Mark issues with this. deferred This issue is documented here and someone might want to fix it later, but it takes no priority infrastructure Infrastructure related issues or changes (CMake, dependencies, CI) no-reproducible Needs to be reproducible before getting further attention. and removed no-reproducible Needs to be reproducible before getting further attention. labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working (correctness). Mark issues with this. deferred This issue is documented here and someone might want to fix it later, but it takes no priority infrastructure Infrastructure related issues or changes (CMake, dependencies, CI)
Projects
None yet
Development

No branches or pull requests

2 participants