Important Dates

Latest Posts

Topic: please help debugging

tothxa
Avatar
Topic Opener
Joined: 2021-03-24, 12:44
Posts: 460
OS: antix / Debian
Version: some new PR I'm testing
Ranking
Tribe Member
Posted at: 2021-10-01, 13:55

My mousewheel changes are getting ready for review, but I ran into a problem, and I'm not sure any more that it is caused (ie. not just easier to trigger) by my code. The current version is at https://github.com/tothxa/widelands/tree/mousewheel-simplify . Please feel free to comment on it, but I'm specifically looking for advice for tracking down a segfault. A debug log is attached. The segfault can be triggered by opening the Options window, then resizing the main game window by dragging on the window border. Sometimes it crashes quite fast, sometimes it needs a lot of dragging the mouse around (maybe related to the speed of dragging).

(my system is still debian buster)


Attachment:
debug_log.txt (7.5 KB)

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 2029
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2021-10-01, 15:20

Might this be related to https://github.com/widelands/widelands/issues/5015?
Compiling this now to have a look…


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 2029
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2021-10-01, 15:59

Yep seems to be the same as #5015 so it's not related to your branch. But I think I see now what causes it, will try to fix this…

=================================================================
==32992==ERROR: AddressSanitizer: heap-use-after-free on address 0x603001672018 at pc 0x55882e9447ea bp 0x7ffff786a3f0 sp 0x7ffff786a3e0
READ of size 4 at 0x603001672018 thread T0
    #0 0x55882e9447e9 in RenderTarget::clip(Rect<float>&) const ../src/graphic/rendertarget.cc:339
    #1 0x55882e94098f in RenderTarget::enter_window(Rect<int> const&, Rect<int>*, Vector2<int>*) ../src/graphic/rendertarget.cc:75
    #2 0x55882ed76ccc in UI::Panel::do_draw(RenderTarget&) ../src/ui_basic/panel.cc:1190
    #3 0x55882ed6e4c1 in UI::Panel::do_redraw_now(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ../src/ui_basic/panel.cc:269
    #4 0x55882ed6fe7e in UI::Panel::do_run() ../src/ui_basic/panel.cc:418
    #5 0x55882ee73359 in FsMenu::MenuTarget UI::Panel::run<FsMenu::MenuTarget>() ../src/ui_basic/panel.h:125
    #6 0x55882eed48ec in FsMenu::OptionsCtrl::handle_menu() ../src/ui_fsmenu/options.cc:787
    #7 0x55882eed46e8 in FsMenu::OptionsCtrl::OptionsCtrl(FsMenu::MainMenu&, Section&) ../src/ui_fsmenu/options.cc:783
    #8 0x55882ee5c5e9 in FsMenu::MainMenu::action(FsMenu::MenuTarget) ../src/ui_fsmenu/main.cc:839
    #9 0x55882ee57418 in operator() ../src/ui_fsmenu/main.cc:541
    #10 0x55882ee57aba in FsMenu::MainMenu::handle_key(bool, SDL_Keysym) ../src/ui_fsmenu/main.cc:573
    #11 0x55882ed78d4f in UI::Panel::do_key(bool, SDL_Keysym) ../src/ui_basic/panel.cc:1401
    #12 0x55882ed7a419 in UI::Panel::ui_key(bool, SDL_Keysym) ../src/ui_basic/panel.cc:1633
    #13 0x55882e571235 in WLApplication::handle_input(InputCallback const*) ../src/wlapplication.cc:943
    #14 0x55882ed6fc4a in UI::Panel::do_run() ../src/ui_basic/panel.cc:399
    #15 0x55882e5970bf in int UI::Panel::run<int>() ../src/ui_basic/panel.h:125
    #16 0x55882e56dd01 in WLApplication::run() ../src/wlapplication.cc:815
    #17 0x55882e5610d8 in main ../src/main.cc:47
    #18 0x7fadf6974564 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28564)
    #19 0x55882e560ecd in _start (/home/benedikt/wl/building-fastplace/widelands+0x6e0ecd)

0x603001672018 is located 24 bytes inside of 32-byte region [0x603001672000,0x603001672020)
freed by thread T0 here:
    #0 0x7fadf91280c7 in operator delete(void*) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:160
    #1 0x55882e8f773c in std::default_delete<RenderTarget>::operator()(RenderTarget*) const /usr/include/c++/10/bits/unique_ptr.h:85
    #2 0x55882e8f8068 in std::__uniq_ptr_impl<RenderTarget, std::default_delete<RenderTarget> >::reset(RenderTarget*) (/home/benedikt/wl/building-fastplace/widelands+0xa78068)
    #3 0x55882e8f71f5 in std::unique_ptr<RenderTarget, std::default_delete<RenderTarget> >::reset(RenderTarget*) /usr/include/c++/10/bits/unique_ptr.h:456
    #4 0x55882e8f31cd in Graphic::resolution_changed() ../src/graphic/graphic.cc:222
    #5 0x55882e8f2d94 in Graphic::change_resolution(int, int, bool) ../src/graphic/graphic.cc:193
    #6 0x55882e571845 in WLApplication::handle_input(InputCallback const*) ../src/wlapplication.cc:975
    #7 0x55882ed6e44e in UI::Panel::do_redraw_now(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ../src/ui_basic/panel.cc:264
    #8 0x55882ed6fe7e in UI::Panel::do_run() ../src/ui_basic/panel.cc:418
    #9 0x55882ee73359 in FsMenu::MenuTarget UI::Panel::run<FsMenu::MenuTarget>() ../src/ui_basic/panel.h:125
    #10 0x55882eed48ec in FsMenu::OptionsCtrl::handle_menu() ../src/ui_fsmenu/options.cc:787
    #11 0x55882eed46e8 in FsMenu::OptionsCtrl::OptionsCtrl(FsMenu::MainMenu&, Section&) ../src/ui_fsmenu/options.cc:783
    #12 0x55882ee5c5e9 in FsMenu::MainMenu::action(FsMenu::MenuTarget) ../src/ui_fsmenu/main.cc:839
    #13 0x55882ee57418 in operator() ../src/ui_fsmenu/main.cc:541
    #14 0x55882ee57aba in FsMenu::MainMenu::handle_key(bool, SDL_Keysym) ../src/ui_fsmenu/main.cc:573
    #15 0x55882ed78d4f in UI::Panel::do_key(bool, SDL_Keysym) ../src/ui_basic/panel.cc:1401
    #16 0x55882ed7a419 in UI::Panel::ui_key(bool, SDL_Keysym) ../src/ui_basic/panel.cc:1633
    #17 0x55882e571235 in WLApplication::handle_input(InputCallback const*) ../src/wlapplication.cc:943
    #18 0x55882ed6fc4a in UI::Panel::do_run() ../src/ui_basic/panel.cc:399
    #19 0x55882e5970bf in int UI::Panel::run<int>() ../src/ui_basic/panel.h:125
    #20 0x55882e56dd01 in WLApplication::run() ../src/wlapplication.cc:815
    #21 0x55882e5610d8 in main ../src/main.cc:47
    #22 0x7fadf6974564 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28564)

previously allocated by thread T0 here:
    #0 0x7fadf91275a7 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
    #1 0x55882e8f31ac in Graphic::resolution_changed() ../src/graphic/graphic.cc:222
    #2 0x55882e8f2d94 in Graphic::change_resolution(int, int, bool) ../src/graphic/graphic.cc:193
    #3 0x55882e571845 in WLApplication::handle_input(InputCallback const*) ../src/wlapplication.cc:975
    #4 0x55882ed6fc4a in UI::Panel::do_run() ../src/ui_basic/panel.cc:399
    #5 0x55882ee73359 in FsMenu::MenuTarget UI::Panel::run<FsMenu::MenuTarget>() ../src/ui_basic/panel.h:125
    #6 0x55882eed48ec in FsMenu::OptionsCtrl::handle_menu() ../src/ui_fsmenu/options.cc:787
    #7 0x55882eed46e8 in FsMenu::OptionsCtrl::OptionsCtrl(FsMenu::MainMenu&, Section&) ../src/ui_fsmenu/options.cc:783
    #8 0x55882ee5c5e9 in FsMenu::MainMenu::action(FsMenu::MenuTarget) ../src/ui_fsmenu/main.cc:839
    #9 0x55882ee57418 in operator() ../src/ui_fsmenu/main.cc:541
    #10 0x55882ee57aba in FsMenu::MainMenu::handle_key(bool, SDL_Keysym) ../src/ui_fsmenu/main.cc:573
    #11 0x55882ed78d4f in UI::Panel::do_key(bool, SDL_Keysym) ../src/ui_basic/panel.cc:1401
    #12 0x55882ed7a419 in UI::Panel::ui_key(bool, SDL_Keysym) ../src/ui_basic/panel.cc:1633
    #13 0x55882e571235 in WLApplication::handle_input(InputCallback const*) ../src/wlapplication.cc:943
    #14 0x55882ed6fc4a in UI::Panel::do_run() ../src/ui_basic/panel.cc:399
    #15 0x55882e5970bf in int UI::Panel::run<int>() ../src/ui_basic/panel.h:125
    #16 0x55882e56dd01 in WLApplication::run() ../src/wlapplication.cc:815
    #17 0x55882e5610d8 in main ../src/main.cc:47
    #18 0x7fadf6974564 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28564)

SUMMARY: AddressSanitizer: heap-use-after-free ../src/graphic/rendertarget.cc:339 in RenderTarget::clip(Rect<float>&) const
Shadow bytes around the buggy address:
  0x0c06802c63b0: fa fa fd fd fd fd fa fa fd fd fd fd fa fa fd fd
  0x0c06802c63c0: fd fd fa fa fd fd fd fd fa fa fd fd fd fd fa fa
  0x0c06802c63d0: fd fd fd fd fa fa fd fd fd fd fa fa fd fd fd fd
  0x0c06802c63e0: fa fa fd fd fd fd fa fa fd fd fd fd fa fa fd fd
  0x0c06802c63f0: fd fd fa fa fd fd fd fd fa fa fd fd fd fd fa fa
=>0x0c06802c6400: fd fd fd[fd]fa fa fd fd fd fd fa fa fd fd fd fa
  0x0c06802c6410: fa fa fd fd fd fd fa fa fd fd fd fa fa fa fd fd
  0x0c06802c6420: fd fd fa fa fd fd fd fa fa fa fd fd fd fd fa fa
  0x0c06802c6430: fd fd fd fa fa fa fd fd fd fd fa fa fd fd fd fa
  0x0c06802c6440: fa fa fd fd fd fd fa fa fd fd fd fa fa fa fd fd
  0x0c06802c6450: fd fd fa fa fd fd fd fa fa fa fd fd fd fd 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
==32992==ABORTING

Top Quote
tothxa
Avatar
Topic Opener
Joined: 2021-03-24, 12:44
Posts: 460
OS: antix / Debian
Version: some new PR I'm testing
Ranking
Tribe Member
Posted at: 2021-10-01, 16:22

Thank you once again!

I'll prepare the pull request then...


Top Quote