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 116_PW_scan_Si2_nspin2 #5206

Closed
16 tasks
kirk0830 opened this issue Oct 7, 2024 · 0 comments · Fixed by #5208
Closed
16 tasks

Bug: memory leak detected in integrated test case 116_PW_scan_Si2_nspin2 #5206

kirk0830 opened this issue Oct 7, 2024 · 0 comments · Fixed by #5208
Assignees
Labels
Bugs Bugs that only solvable with sufficient knowledge of DFT

Comments

@kirk0830
Copy link
Collaborator

kirk0830 commented Oct 7, 2024

Describe the bug

=================================================================
==44496==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f614a171a00 at pc 0x5555deb2bd1c bp 0x7f614b98dfd0 sp 0x7f614b98dfc0
READ of size 8 at 0x7f614a171a00 thread T4
#0 0x5555deb2bd1b in XC_Functional_Libxc::cal_gdr(int, std::vector<double, std::allocator > const&, double, Charge const*) [clone ._omp_fn.0] /__w/abacus-develop/abacus-develop/source/module_hamilt_general/module_xc/xc_functional_libxc_tools.cpp:67
#1 0x7f618eb8bc0d (/lib/x86_64-linux-gnu/libgomp.so.1+0x1dc0d)
#2 0x7f6174a83ac2 (/lib/x86_64-linux-gnu/libc.so.6+0x94ac2)
#3 0x7f6174b14a03 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x125a03)

0x7f614a171a00 is located 0 bytes to the right of 373248-byte region [0x7f614a116800,0x7f614a171a00)
allocated by thread T0 here:
#0 0x7f618fa631e7 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
#1 0x5555deb2dc3c in __gnu_cxx::new_allocator::allocate(unsigned long, void const*) /usr/include/c++/11/ext/new_allocator.h:127
#2 0x5555deb2dc3c in std::allocator_traits<std::allocator >::allocate(std::allocator&, unsigned long) /usr/include/c++/11/bits/alloc_traits.h:464
#3 0x5555deb2dc3c in std::_Vector_base<double, std::allocator >::_M_allocate(unsigned long) /usr/include/c++/11/bits/stl_vector.h:346
#4 0x5555deb2dc3c in std::_Vector_base<double, std::allocator >::_M_create_storage(unsigned long) /usr/include/c++/11/bits/stl_vector.h:361
#5 0x5555deb2dc3c in std::_Vector_base<double, std::allocator >::_Vector_base(unsigned long, std::allocator const&) /usr/include/c++/11/bits/stl_vector.h:305
#6 0x5555deb2dc3c in std::vector<double, std::allocator >::vector(unsigned long, std::allocator const&) /usr/include/c++/11/bits/stl_vector.h:511
#7 0x5555deb2dc3c in XC_Functional_Libxc::convert_rho(int, unsigned long, Charge const*) /__w/abacus-develop/abacus-develop/source/module_hamilt_general/module_xc/xc_functional_libxc_tools.cpp:14
#8 0x5555deb3a4c5 in XC_Functional_Libxc::v_xc_meta(std::vector<int, std::allocator > const&, int const&, double const&, double, Charge const*) /__w/abacus-develop/abacus-develop/source/module_hamilt_general/module_xc/xc_functional_libxc_vxc.cpp:184
#9 0x5555dec929cb in elecstate::PotXC::cal_v_eff(Charge const*, UnitCell const*, ModuleBase::matrix&) /__w/abacus-develop/abacus-develop/source/module_elecstate/potentials/pot_xc.cpp:27
#10 0x5555dec963e7 in elecstate::Potential::cal_v_eff(Charge const*, UnitCell const*, ModuleBase::matrix&) /__w/abacus-develop/abacus-develop/source/module_elecstate/potentials/potential_new.cpp:274
#11 0x5555dec98700 in elecstate::Potential::update_from_charge(Charge const*, UnitCell const*) /__w/abacus-develop/abacus-develop/source/module_elecstate/potentials/potential_new.cpp:165
#12 0x5555dec9995d in elecstate::Potential::init_pot(int, Charge const*) /__w/abacus-develop/abacus-develop/source/module_elecstate/potentials/potential_new.cpp:290
#13 0x5555defadfa0 in ModuleESolver::ESolver_KS_PW<std::complex, base_device::DEVICE_CPU>::before_scf(int) /__w/abacus-develop/abacus-develop/source/module_esolver/esolver_ks_pw.cpp:222
#14 0x5555def7bd5a in ModuleESolver::ESolver_KS<std::complex, base_device::DEVICE_CPU>::runner(int, UnitCell&) /__w/abacus-develop/abacus-develop/source/module_esolver/esolver_ks.cpp:409
#15 0x5555deac8a86 in Relax_Driver::relax_driver(ModuleESolver::ESolver*) /__w/abacus-develop/abacus-develop/source/module_relax/relax_driver.cpp:51
#16 0x5555deb029b4 in Driver::driver_run() /__w/abacus-develop/abacus-develop/source/driver_run.cpp:68
#17 0x5555deafb6ce in Driver::atomic_world() /__w/abacus-develop/abacus-develop/source/driver.cpp:186
#18 0x5555deb00a46 in Driver::init() /__w/abacus-develop/abacus-develop/source/driver.cpp:40
#19 0x5555de11b77a in main /__w/abacus-develop/abacus-develop/source/main.cpp:42

Thread T4 created by T0 here:
#0 0x7f618fa05685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216
#1 0x7f618eb8c25f (/lib/x86_64-linux-gnu/libgomp.so.1+0x1e25f)
#2 0x7f618eb82a10 in GOMP_parallel (/lib/x86_64-linux-gnu/libgomp.so.1+0x14a10)
#3 0x6190000e2f7f ()

SUMMARY: AddressSanitizer: heap-buffer-overflow /__w/abacus-develop/abacus-develop/source/module_hamilt_general/module_xc/xc_functional_libxc_tools.cpp:67 in XC_Functional_Libxc::cal_gdr(int, std::vector<double, std::allocator > const&, double, Charge const*) [clone ._omp_fn.0]
Shadow bytes around the buggy address:
0x0feca94262f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0feca9426300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0feca9426310: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0feca9426320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0feca9426330: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0feca9426340:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0feca9426350: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0feca9426360: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0feca9426370: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0feca9426380: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0feca9426390: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
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
==44496==ABORTING

Image

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).
@kirk0830 kirk0830 added the Bugs Bugs that only solvable with sufficient knowledge of DFT label Oct 7, 2024
@kirk0830 kirk0830 linked a pull request Oct 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugs Bugs that only solvable with sufficient knowledge of DFT
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants