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

Crash during shutdown #157

Open
DarthGandalf opened this issue Dec 15, 2023 · 1 comment
Open

Crash during shutdown #157

DarthGandalf opened this issue Dec 15, 2023 · 1 comment
Assignees

Comments

@DarthGandalf
Copy link
Contributor

Doesn't happens always, but from time to time.

[22:30:17.245] [info] -> Shutting down...                                                                                                                                                                                                                                         
=================================================================                                                                                                                                                                                                                 
==11919==ERROR: AddressSanitizer: container-overflow on address 0x506000055f68 at pc 0x5639c52582ca bp 0x7f1d975f6c50 sp 0x7f1d975f6c48                                                                                                                                           
READ of size 8 at 0x506000055f68 thread T10                                                                                                                                                                                                                                       
    #0 0x5639c52582c9 in Abyss::AbyssEngine::fillAudioBuffer(unsigned char*, int) const /home/somebody/AbyssEngine/src/Abyss/AbyssEngine.cpp:265:37                                                                                                                               
    #1 0x5639c54dadcd in SDL_RunAudio /home/somebody/vcpkg/buildtrees/sdl2/src/ase-2.28.5-29008dc59c.clean/src/audio/SDL_audio.c:717:13                                                                                                                                           
    #2 0x5639c53b64b5 in SDL_RunThread /home/somebody/vcpkg/buildtrees/sdl2/src/ase-2.28.5-29008dc59c.clean/src/thread/SDL_thread.c:292:18                                                                                                                                        
    #3 0x5639c54cfa54 in RunThread /home/somebody/vcpkg/buildtrees/sdl2/src/ase-2.28.5-29008dc59c.clean/src/thread/pthread/SDL_systhread.c:76:5                                                                                                                                   
    #4 0x5639c4f015aa in asan_thread_start(void*) /mnt/portagetmp/portage/sys-libs/compiler-rt-sanitizers-17.0.6/work/compiler-rt/lib/asan/asan_interceptors.cpp:225:31                                                                                                           
    #5 0x7f1db68c42b8 in start_thread /mnt/portagetmp/portage/sys-libs/glibc-2.37-r7/work/glibc-2.37/nptl/pthread_create.c:444:8                                                                                                                                                  
    #6 0x7f1db69474bb in clone3 /mnt/portagetmp/portage/sys-libs/glibc-2.37-r7/work/glibc-2.37/misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81                                                                                                                                 
                                                                                                                                                                                                                                                                                  
0x506000055f68 is located 40 bytes inside of 64-byte region [0x506000055f40,0x506000055f80)                                                                                                                                                                                       
allocated by thread T0 here:                                                                                                                                                                                                                                                      
    #0 0x5639c4f425fd in operator new(unsigned long) /mnt/portagetmp/portage/sys-libs/compiler-rt-sanitizers-17.0.6/work/compiler-rt/lib/asan/asan_new_delete.cpp:95:3                                                                                                            
    #1 0x5639c526a8aa in void* std::__1::__libcpp_operator_new[abi:ue170006]<unsigned long>(unsigned long) /usr/include/c++/v1/new:268:10                                                                                                                                         
    #2 0x5639c526a8aa in std::__1::__libcpp_allocate[abi:ue170006](unsigned long, unsigned long) /usr/include/c++/v1/new:294:10                                                                                                                                                   
    #3 0x5639c526a8aa in std::__1::allocator<Abyss::Common::SoundEffectInterface*>::allocate[abi:ue170006](unsigned long) /usr/include/c++/v1/__memory/allocator.h:114:38                                                                                                         
    #4 0x5639c526a8aa in std::__1::__allocation_result<std::__1::allocator_traits<std::__1::allocator<Abyss::Common::SoundEffectInterface*>>::pointer> std::__1::__allocate_at_least[abi:ue170006]<std::__1::allocator<Abyss::Common::SoundEffectInterface*>>(std::__1::allocator<
Abyss::Common::SoundEffectInterface*>&, unsigned long) /usr/include/c++/v1/__memory/allocate_at_least.h:55:19                                                                                                                                                                     
    #5 0x5639c526a8aa in std::__1::__split_buffer<Abyss::Common::SoundEffectInterface*, std::__1::allocator<Abyss::Common::SoundEffectInterface*>&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<Abyss::Common::SoundEffectInterface*>&) /usr/include/c++/v1/
__split_buffer:379:29                                                                                                                                                                                                                                                             
    #6 0x5639c526a8aa in void std::__1::vector<Abyss::Common::SoundEffectInterface*, std::__1::allocator<Abyss::Common::SoundEffectInterface*>>::__push_back_slow_path<Abyss::Common::SoundEffectInterface* const&>(Abyss::Common::SoundEffectInterface* const&) /usr/include/c++/
v1/vector:1616:49                                                                                                                                                                                                                                                                 
    #7 0x5639c525ccd2 in std::__1::vector<Abyss::Common::SoundEffectInterface*, std::__1::allocator<Abyss::Common::SoundEffectInterface*>>::push_back[abi:ue170006](Abyss::Common::SoundEffectInterface* const&) /usr/include/c++/v1/vector:1634:9                                
    #8 0x5639c525ccd2 in Abyss::AbyssEngine::addSoundEffect(Abyss::Common::SoundEffectInterface*) /home/somebody/AbyssEngine/src/Abyss/AbyssEngine.cpp:406:93                                                                                                                     
    #9 0x5639c525ccd2 in non-virtual thunk to Abyss::AbyssEngine::addSoundEffect(Abyss::Common::SoundEffectInterface*) /home/somebody/AbyssEngine/src/Abyss/AbyssEngine.cpp                                                                                                       
    #10 0x5639c5250637 in Abyss::Streams::SoundEffect::SoundEffect(std::__1::unique_ptr<Abyss::Streams::AudioStream, std::__1::default_delete<Abyss::Streams::AudioStream>>) /home/somebody/AbyssEngine/src/Abyss/Streams/SoundEffect.cpp:11:42                                   
    #11 0x5639c4f68f06 in Abyss::UI::Button<Abyss::DataTypes::DC6>::Button(Abyss::UI::ButtonDef const&, std::__1::basic_string_view<char, std::__1::char_traits<char>>, Abyss::Concepts::FontRenderer const&, std::__1::function<void ()>) /home/somebody/AbyssEngine/src/Abyss/..
/Abyss/UI/Button.h:62:11                                                                                                                                                                                                                                                          
    #12 0x5639c4f646c2 in OD2::Common::CreateButton(std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::basic_string_view<char, std::__1::char_traits<char>>, std::__1::function<void ()> const&) /home/somebody/AbyssEngine/src/Abyss/../OD2/Common/ButtonD
efManager.h:58:12                                                                                                                                                                                                                                                                 
    #13 0x5639c4f6314e in OD2::Scenes::MainMenu::MainMenu::MainMenu() /home/somebody/AbyssEngine/src/OD2/Scenes/MainMenu/MainMenu.h:50:57                                                                                                                                         
    #14 0x5639c4f8db0f in std::__1::__unique_if<OD2::Scenes::MainMenu::MainMenu>::__unique_single std::__1::make_unique[abi:ue170006]<OD2::Scenes::MainMenu::MainMenu>() /usr/include/c++/v1/__memory/unique_ptr.h:689:30                                                         
    #15 0x5639c4f8db0f in main /home/somebody/AbyssEngine/src/OD2/main.cpp:264:25                                                                                                                                                                                                 
    #16 0x7f1db68619c9 in __libc_start_call_main /mnt/portagetmp/portage/sys-libs/glibc-2.37-r7/work/glibc-2.37/csu/../sysdeps/nptl/libc_start_call_main.h:58:16                                                                                                                  
                                                                                                                                                                                                                                                                                  
Thread T10 created by T0 here:                                                                                                                                                                                                                                                    
    #0 0x5639c4ee999c in pthread_create /mnt/portagetmp/portage/sys-libs/compiler-rt-sanitizers-17.0.6/work/compiler-rt/lib/asan/asan_interceptors.cpp:237:3                                                                                                                      
    #1 0x5639c54cf9ed in SDL_SYS_CreateThread /home/somebody/vcpkg/buildtrees/sdl2/src/ase-2.28.5-29008dc59c.clean/src/thread/pthread/SDL_systhread.c:116:9                                                                                                                       
    #2 0x5639c53b6610 in SDL_CreateThreadWithStackSize_REAL /home/somebody/vcpkg/buildtrees/sdl2/src/ase-2.28.5-29008dc59c.clean/src/thread/SDL_thread.c:358:11                                                                                                                   
    #3 0x5639c53b675c in SDL_CreateThreadInternal /home/somebody/vcpkg/buildtrees/sdl2/src/ase-2.28.5-29008dc59c.clean/src/thread/SDL_thread.c:409:12                                                                                                                             
    #4 0x5639c54d96ff in open_audio_device /home/somebody/vcpkg/buildtrees/sdl2/src/ase-2.28.5-29008dc59c.clean/src/audio/SDL_audio.c:1509:26
    #5 0x5639c54d8928 in SDL_OpenAudio_REAL /home/somebody/vcpkg/buildtrees/sdl2/src/ase-2.28.5-29008dc59c.clean/src/audio/SDL_audio.c:1540:14
    #6 0x5639c534a690 in SDL_OpenAudio /home/somebody/vcpkg/buildtrees/sdl2/src/ase-2.28.5-29008dc59c.clean/src/dynapi/SDL_dynapi_procs.h:112:1
    #7 0x5639c5254f21 in Abyss::AbyssEngine::initializeAudio() /home/somebody/AbyssEngine/src/Abyss/AbyssEngine.cpp:241:9
    #8 0x5639c5253614 in Abyss::AbyssEngine::AbyssEngine() /home/somebody/AbyssEngine/src/Abyss/AbyssEngine.cpp:38:5
    #9 0x5639c525834a in Abyss::AbyssEngine::getInstance() /home/somebody/AbyssEngine/src/Abyss/AbyssEngine.cpp:280:24
    #10 0x5639c4f8da25 in main /home/somebody/AbyssEngine/src/OD2/main.cpp:246:24
    #11 0x7f1db68619c9 in __libc_start_call_main /mnt/portagetmp/portage/sys-libs/glibc-2.37-r7/work/glibc-2.37/csu/../sysdeps/nptl/libc_start_call_main.h:58:16

HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_container_overflow=0.
If you suspect a false positive see also: https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow.
SUMMARY: AddressSanitizer: container-overflow /home/somebody/AbyssEngine/src/Abyss/AbyssEngine.cpp:265:37 in Abyss::AbyssEngine::fillAudioBuffer(unsigned char*, int) const
Shadow bytes around the buggy address:
  0x506000055c80: fa fa fa fa 00 00 00 00 00 00 00 00 fa fa fa fa
  0x506000055d00: 00 00 00 00 00 00 00 00 fa fa fa fa fd fd fd fd
  0x506000055d80: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fd
  0x506000055e00: fa fa fa fa fd fd fd fd fd fd fd fd fa fa fa fa
  0x506000055e80: fd fd fd fd fd fd fd fd fa fa fa fa fd fd fd fd
=>0x506000055f00: fd fd fd fd fa fa fa fa fc fc fc fc fc[fc]fc fc
  0x506000055f80: fa fa fa fa fd fd fd fd fd fd fd fd fa fa fa fa
  0x506000056000: 00 00 00 00 00 00 00 00 fa fa fa fa 00 00 00 00
  0x506000056080: 00 00 00 00 fa fa fa fa 00 00 00 00 00 00 00 00
  0x506000056100: fa fa fa fa fd fd fd fd fd fd fd fd fa fa fa fa
  0x506000056180: fd fd fd fd fd fd fd fd fa fa fa fa 00 00 00 00
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
==11919==ABORTING
@essial essial self-assigned this Dec 16, 2023
@essial
Copy link
Contributor

essial commented Dec 16, 2023

I'm 90% sure this can be fixed with a mutex around the sound effects enumeration as it is most likely being iterated when sound effects are being disposed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants