deepmodeling / abacus-develop

An electronic structure package based on either plane wave basis or numerical atomic orbitals.
http://abacus.ustc.edu.cn
GNU Lesser General Public License v3.0
174 stars 136 forks source link

Bug: memory leak detected in integrated test case 312_NO_GO_wfc_get_wf #5566

Open kirk0830 opened 12 hours ago

kirk0830 commented 12 hours ago

Describe the bug

## Test case 312_NO_GO_wfc_get_wf

### On process id asan.109282

```bash
=================================================================
==109282==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x55711423528e bp 0x7ffe0cec9490 sp 0x7ffe0cec93a0 T0)
==109282==The signal is caused by a WRITE memory access.
==109282==Hint: address points to the zero page.
    #0 0x55711423528e in void ModulePW::PW_Basis_K::real2recip<double>(std::complex<double> const*, std::complex<double>*, int, bool, double) const [clone ._omp_fn.2] /usr/include/c++/11/complex:414
    #1 0x7f1e7a0a0a15 in GOMP_parallel (/lib/x86_64-linux-gnu/libgomp.so.1+0x14a15)
    #2 0x5571142392d5 in void ModulePW::PW_Basis_K::real2recip<double>(std::complex<double> const*, std::complex<double>*, int, bool, double) const /__w/abacus-develop/abacus-develop/source/module_basis/module_pw/pw_transform_k.cpp:67
    #3 0x557114515263 in IState_Envelope::set_pw_wfc(ModulePW::PW_Basis_K const*, int const&, int const&, int const&, double const* const*, psi::Psi<std::complex<double>, base_device::DEVICE_CPU>&) /__w/abacus-develop/abacus-develop/source/module_io/get_wf_lcao.cpp:602
    #4 0x557114519a20 in IState_Envelope::begin(psi::Psi<double, base_device::DEVICE_CPU> const*, ModulePW::PW_Basis const*, ModulePW::PW_Basis_K const*, ModulePW::PW_Basis_Big const*, Parallel_Orbitals const&, Gint_Gamma&, int const&, int const&, K_Vectors const&, double, int, std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&, int, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /__w/abacus-develop/abacus-develop/source/module_io/get_wf_lcao.cpp:187
    #5 0x557114d5c6eb in ModuleESolver::ESolver_KS_LCAO<double, double>::others(int) /__w/abacus-develop/abacus-develop/source/module_esolver/lcao_others.cpp:327
    #6 0x5571147c6655 in Driver::driver_run() /__w/abacus-develop/abacus-develop/source/driver_run.cpp:82
    #7 0x5571147bf11e in Driver::atomic_world() /__w/abacus-develop/abacus-develop/source/driver.cpp:186
    #8 0x5571147c4496 in Driver::init() /__w/abacus-develop/abacus-develop/source/driver.cpp:40
    #9 0x557113d9186f in main /__w/abacus-develop/abacus-develop/source/main.cpp:43
    #10 0x7f1e5ff30d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
    #11 0x7f1e5ff30e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
    #12 0x557113df0e54 in _start (/usr/local/bin/abacus+0x2d1e54)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /usr/include/c++/11/complex:414 in void ModulePW::PW_Basis_K::real2recip<double>(std::complex<double> const*, std::complex<double>*, int, bool, double) const [clone ._omp_fn.2]
==109282==ABORTING

On process id asan.109283

=================================================================
==109283==ERROR: AddressSanitizer: SEGV on unknown address 0x000000004000 (pc 0x55e488af428e bp 0x7f86a97e4010 sp 0x7f86a97e3f20 T4)
==109283==The signal is caused by a WRITE memory access.
    #0 0x55e488af428e in void ModulePW::PW_Basis_K::real2recip<double>(std::complex<double> const*, std::complex<double>*, int, bool, double) const [clone ._omp_fn.2] /usr/include/c++/11/complex:414
    #1 0x7f86ec79cc0d  (/lib/x86_64-linux-gnu/libgomp.so.1+0x1dc0d)
    #2 0x7f86d2693ac2  (/lib/x86_64-linux-gnu/libc.so.6+0x94ac2)
    #3 0x7f86d2724a03 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x125a03)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /usr/include/c++/11/complex:414 in void ModulePW::PW_Basis_K::real2recip<double>(std::complex<double> const*, std::complex<double>*, int, bool, double) const [clone ._omp_fn.2]
Thread T4 created by T0 here:
    #0 0x7f86ed616685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216
    #1 0x7f86ec79d25f  (/lib/x86_64-linux-gnu/libgomp.so.1+0x1e25f)
    #2 0x7f86ec793a10 in GOMP_parallel (/lib/x86_64-linux-gnu/libgomp.so.1+0x14a10)
    #3 0x62000008916f  (<unknown module>)

==109283==ABORTING

Expected behavior

No response

To Reproduce

No response

Environment

No response

Additional Context

No response

Task list for Issue attackers (only for developers)