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: memory leak detected in integrated test case 120_PW_KP_MD_MSST #5228

Open
16 tasks
kirk0830 opened this issue Oct 14, 2024 · 0 comments
Open
16 tasks

Bug: memory leak detected in integrated test case 120_PW_KP_MD_MSST #5228

kirk0830 opened this issue Oct 14, 2024 · 0 comments
Assignees
Labels
Bugs (Exclude input and output) Bugs that only solvable with sufficient knowledge of DFT

Comments

@kirk0830
Copy link
Collaborator

Describe the bug

Test case 120_PW_KP_MD_MSST

On process id asan.48040

=================================================================
==48040==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x604000114740 at pc 0x5639ee3e1555 bp 0x7ffff8279440 sp 0x7ffff8279430
READ of size 8 at 0x604000114740 thread T0
    #0 0x5639ee3e1554 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const /usr/include/c++/11/bits/basic_string.h:921
    #1 0x5639ee3e1554 in std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/include/c++/11/bits/basic_string.h:6536
    #2 0x5639ee3e1554 in MD_func::dump_info(int const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, UnitCell const&, Parameter const&, ModuleBase::matrix const&, ModuleBase::Vector3<double> const*, ModuleBase::Vector3<double> const*) /__w/abacus-develop/abacus-develop/source/module_md/md_func.cpp:385
    #3 0x5639ee3ffc9a in Run_MD::md_line(UnitCell&, ModuleESolver::ESolver*, Parameter const&) /__w/abacus-develop/abacus-develop/source/module_md/run_md.cpp:89
    #4 0x5639ee9b94a7 in Driver::driver_run() /__w/abacus-develop/abacus-develop/source/driver_run.cpp:63
    #5 0x5639ee9b2bbe in Driver::atomic_world() /__w/abacus-develop/abacus-develop/source/driver.cpp:186
    #6 0x5639ee9b7f36 in Driver::init() /__w/abacus-develop/abacus-develop/source/driver.cpp:40
    #7 0x5639edfc831a in main /__w/abacus-develop/abacus-develop/source/main.cpp:42
    #8 0x7f7392186d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
    #9 0x7f7392186e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
    #10 0x5639edfff5a4 in _start (/usr/local/bin/abacus+0x29c5a4)

0x604000114740 is located 8 bytes to the right of 40-byte region [0x604000114710,0x604000114738)
allocated by thread T0 here:
    #0 0x7f73ad1d2357 in operator new[](unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:102
    #1 0x5639ee291533 in UnitCell::UnitCell() /__w/abacus-develop/abacus-develop/source/module_cell/unitcell.cpp:64
    #2 0x5639edfef405 in __static_initialization_and_destruction_0 /__w/abacus-develop/abacus-develop/source/module_hamilt_pw/hamilt_pwdft/global.cpp:11
    #3 0x5639edfef405 in _GLOBAL__sub_I__ZN7GlobalC6ppcellE /__w/abacus-develop/abacus-develop/source/module_hamilt_pw/hamilt_pwdft/global.cpp:15
    #4 0x7f7392186eba in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29eba)

SUMMARY: AddressSanitizer: heap-buffer-overflow /usr/include/c++/11/bits/basic_string.h:921 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const
Shadow bytes around the buggy address:
  0x0c088001a890: fa fa 00 00 00 00 00 04 fa fa 00 00 00 00 00 04
  0x0c088001a8a0: fa fa 00 00 00 00 00 04 fa fa 00 00 00 00 00 04
  0x0c088001a8b0: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00
  0x0c088001a8c0: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00
  0x0c088001a8d0: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00
=>0x0c088001a8e0: fa fa 00 00 00 00 00 fa[fa]fa 00 00 00 00 00 fa
  0x0c088001a8f0: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 fa
  0x0c088001a900: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 00
  0x0c088001a910: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 00
  0x0c088001a920: fa fa fa fa fa fa fa fa fa fa 00 00 00 00 06 fa
  0x0c088001a930: fa fa fa fa fa fa fa fa fa fa 00 00 00 00 00 02
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==48040==ABORTING

Expected behavior

No response

To Reproduce

No response

Environment

No response

Additional Context

No response

Task list for Issue attackers (only for developers)

  • Verify the issue is not a duplicate.
  • Describe the bug.
  • Steps to reproduce.
  • Expected behavior.
  • Error message.
  • Environment details.
  • Additional context.
  • Assign a priority level (low, medium, high, urgent).
  • Assign the issue to a team member.
  • Label the issue with relevant tags.
  • Identify possible related issues.
  • Create a unit test or automated test to reproduce the bug (if applicable).
  • Fix the bug.
  • Test the fix.
  • Update documentation (if necessary).
  • Close the issue and inform the reporter (if applicable).
@mohanchen mohanchen added the Bugs (Exclude input and output) Bugs that only solvable with sufficient knowledge of DFT label Oct 15, 2024
@YuLiu98 YuLiu98 mentioned this issue Oct 20, 2024
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugs (Exclude input and output) Bugs that only solvable with sufficient knowledge of DFT
Projects
None yet
Development

No branches or pull requests

3 participants