← Back to team overview

kicad-developers team mailing list archive

Re: Bug 1834718

 

Hi Wayne-

OK, I'm stumped here. I pushed the tool manager patch because it addresses a couple other issues on Linux and seems neutral in terms of this bug.

What this looks like is that the new progress reporter gets assigned as the parent of the old reporter which is then deleted. We're passing the parent pointer from the tool manager, so it might be helpful to see a printout of the pointer addresses from the `frame()` function call at the beginning and end of the ZoneFillAll() function as well as the beginning of the ZoneFill() function (where it crashes). This should be the same address for the whole time, but it is possible we have some stack-smashing going on here that corrupts the address.

This is really a long-shot but our first/best options didn't really pan out.

-Seth


On 2019-07-01 09:08, Wayne Stambaugh wrote:
Nope :(

#41640 0x000000006d26fb1d in ?? ()
   from E:\msys64\mingw64\bin\wxmsw30u_core_gcc_custom.dll
#41641 0x00000000806e86f7 in WX_PROGRESS_REPORTER::~WX_PROGRESS_REPORTER (
    this=0x1288fae0, __in_chrg=<optimized out>)
    at
E:/msys64/home/Wayne/src/kicad-5.1/common/widgets/progress_reporter.cpp:117
#41642 0x00000000806e8735 in WX_PROGRESS_REPORTER::~WX_PROGRESS_REPORTER (
    this=0x1288fae0, __in_chrg=<optimized out>)
    at
E:/msys64/home/Wayne/src/kicad-5.1/common/widgets/progress_reporter.cpp:118
#41643 0x00000000809da748 in
std::default_delete<WX_PROGRESS_REPORTER>::operator() (this=0x15177128,
__ptr=0x1288fae0)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/unique_ptr.h:81
#41644 0x0000000080a24404 in std::unique_ptr<WX_PROGRESS_REPORTER,
std::default_delete<WX_PROGRESS_REPORTER> >::~unique_ptr (this=0x15177128,
    __in_chrg=<optimized out>)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/unique_ptr.h:289
#41645 0x00000000802e4adf in ZONE_FILLER_TOOL::ZoneFill (this=0x1473b6b0,
    aEvent=...)
    at
E:/msys64/home/Wayne/src/kicad-5.1/pcbnew/tools/zone_filler_tool.cpp:104
#41646 0x0000000080bc7baf in std::__invoke_impl<int, int
(ZONE_FILLER_TOOL::*&)(TOOL_EVENT const&), ZONE_FILLER_TOOL*&,
TOOL_EVENT const&> (__f=
    @0x128902a0: (int (ZONE_FILLER_TOOL::*)(class ZONE_FILLER_TOOL *
const, const class TOOL_EVENT &)) 0x802e4888
<ZONE_FILLER_TOOL::ZoneFill(TOOL_EVENT const&)>, __t=@0x128902b0:
0x1473b6b0, __args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/invoke.h:73
#41647 0x0000000080c17783 in std::__invoke<int
(ZONE_FILLER_TOOL::*&)(TOOL_EVENT const&), ZONE_FILLER_TOOL*&,
TOOL_EVENT const&> (__fn=
    @0x128902a0: (int (ZONE_FILLER_TOOL::*)(class ZONE_FILLER_TOOL *
const, const class TOOL_EVENT &)) 0x802e4888
<ZONE_FILLER_TOOL::ZoneFill(TOOL_EVENT const&)>, __args#0=@0x128902b0:
0x1473b6b0, __args#1=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/invoke.h:95
#41648 0x0000000080ab5b7b in std::_Bind<int
(ZONE_FILLER_TOOL::*(ZONE_FILLER_TOOL*,
std::_Placeholder<1>))(TOOL_EVENT const&)>::__call<int, TOOL_EVENT
const&, 0ull, 1ull>(std::tuple<TOOL_EVENT const&>&&,
std::_Index_tuple<0ull, 1ull>) (
    this=0x128902a0, __args=...)
    at E:/msys64/mingw64/include/c++/9.1.0/functional:400
#41649 0x0000000080ab5ca4 in std::_Bind<int
(ZONE_FILLER_TOOL::*(ZONE_FILLER_TOOL*,
std::_Placeholder<1>))(TOOL_EVENT const&)>::operator()<TOOL_EVENT
const&, int>(TOOL_EVENT const&) (this=0x128902a0, __args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/functional:484
#41650 0x0000000080a90219 in std::_Function_handler<int (TOOL_EVENT
const&), std::_Bind<int (ZONE_FILLER_TOOL::*(ZONE_FILLER_TOOL*,
std::_Placeholder<1>))(TOOL_EVENT const&)> >::_M_invoke(std::_Any_data
const&, TOOL_EVENT const&) (
    __functor=..., __args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/std_function.h:285
#41651 0x0000000080a01b4b in std::function<int (TOOL_EVENT
const&)>::operator()(TOOL_EVENT const&) const (this=0x14793998,
__args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/std_function.h:690
#41652 0x00000000809591ba in COROUTINE<int, TOOL_EVENT const&>::callerStub (
    aData=351771072)
    at E:/msys64/home/Wayne/src/kicad-5.1/include/tool/coroutine.h:331
#41653 0x00000000807b8efa in make_fcontext ()
   from E:\msys64\mingw64\bin\_pcbnew.kiface
#41654 0x0000000014f799c0 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)


On 7/1/2019 8:35 AM, Seth Hillbrand wrote:
Hi Wayne-

Thanks for testing.  If you have a chance, can you give the attached
patch a spin?  This is in place of the previous attempt.

Best-
Seth

On 2019-07-01 07:51, Wayne Stambaugh wrote:
Hey Seth,

No bueno.  Here is the back trace using your patch.

Cheers,

Wayne

#41640 0x000000006d26fb1d in ?? ()
   from E:\msys64\mingw64\bin\wxmsw30u_core_gcc_custom.dll
#41641 0x00000000806e8747 in
WX_PROGRESS_REPORTER::~WX_PROGRESS_REPORTER (
    this=0x12884860, __in_chrg=<optimized out>)
    at
E:/msys64/home/Wayne/src/kicad-5.1/common/widgets/progress_reporter.cpp:117

#41642 0x00000000806e8785 in
WX_PROGRESS_REPORTER::~WX_PROGRESS_REPORTER (
    this=0x12884860, __in_chrg=<optimized out>)
    at
E:/msys64/home/Wayne/src/kicad-5.1/common/widgets/progress_reporter.cpp:118

#41643 0x00000000809da798 in
std::default_delete<WX_PROGRESS_REPORTER>::operator() (this=0x1539f138,
__ptr=0x12884860)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/unique_ptr.h:81
#41644 0x0000000080a24454 in std::unique_ptr<WX_PROGRESS_REPORTER,
std::default_delete<WX_PROGRESS_REPORTER> >::~unique_ptr
(this=0x1539f138,
    __in_chrg=<optimized out>)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/unique_ptr.h:289
#41645 0x00000000802e4b26 in ZONE_FILLER_TOOL::ZoneFill (this=0x14338300,
    aEvent=...)
    at
E:/msys64/home/Wayne/src/kicad-5.1/pcbnew/tools/zone_filler_tool.cpp:103
#41646 0x0000000080bc7b4f in std::__invoke_impl<int, int
(ZONE_FILLER_TOOL::*&)(TOOL_EVENT const&), ZONE_FILLER_TOOL*&,
TOOL_EVENT const&> (__f=
    @0x182d4800: (int (ZONE_FILLER_TOOL::*)(class ZONE_FILLER_TOOL *
const, const class TOOL_EVENT &)) 0x802e4888
<ZONE_FILLER_TOOL::ZoneFill(TOOL_EVENT const&)>, __t=@0x182d4810:
0x14338300, __args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/invoke.h:73
#41647 0x0000000080c17723 in std::__invoke<int
(ZONE_FILLER_TOOL::*&)(TOOL_EVENT const&), ZONE_FILLER_TOOL*&,
TOOL_EVENT const&> (__fn=
    @0x182d4800: (int (ZONE_FILLER_TOOL::*)(class ZONE_FILLER_TOOL *
const, const class TOOL_EVENT &)) 0x802e4888
<ZONE_FILLER_TOOL::ZoneFill(TOOL_EVENT const&)>, __args#0=@0x182d4810:
0x14338300, __args#1=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/invoke.h:95
#41648 0x0000000080ab5bcb in std::_Bind<int
(ZONE_FILLER_TOOL::*(ZONE_FILLER_TOOL*,
std::_Placeholder<1>))(TOOL_EVENT const&)>::__call<int, TOOL_EVENT
const&, 0ull, 1ull>(std::tuple<TOOL_EVENT const&>&&,
std::_Index_tuple<0ull, 1ull>) (
    this=0x182d4800, __args=...)
    at E:/msys64/mingw64/include/c++/9.1.0/functional:400
#41649 0x0000000080ab5cf4 in std::_Bind<int
(ZONE_FILLER_TOOL::*(ZONE_FILLER_TOOL*,
std::_Placeholder<1>))(TOOL_EVENT const&)>::operator()<TOOL_EVENT
const&, int>(TOOL_EVENT const&) (this=0x182d4800, __args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/functional:484
#41650 0x0000000080a90269 in std::_Function_handler<int (TOOL_EVENT
const&), std::_Bind<int (ZONE_FILLER_TOOL::*(ZONE_FILLER_TOOL*,
std::_Placeholder<1>))(TOOL_EVENT const&)> >::_M_invoke(std::_Any_data
const&, TOOL_EVENT const&) (
    __functor=..., __args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/std_function.h:285
#41651 0x0000000080a01b9b in std::function<int (TOOL_EVENT
const&)>::operator()(TOOL_EVENT const&) const (this=0x182d2db8,
__args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/std_function.h:690
#41652 0x000000008095920a in COROUTINE<int, TOOL_EVENT
const&>::callerStub (
    aData=354023872)
    at E:/msys64/home/Wayne/src/kicad-5.1/include/tool/coroutine.h:331
#41653 0x00000000807b8f4a in make_fcontext ()
   from E:\msys64\mingw64\bin\_pcbnew.kiface
#41654 0x000000001519f9c0 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)


On 6/29/2019 3:17 PM, Seth Hillbrand wrote:
Hi Wayne-

That actually helps a lot.  It also explains why this is MSW-only
behavior.

I'm attaching a patch that should address this.  Let me know if it
doesn't help.

Best-
Seth

On 2019-06-29 11:48, Wayne Stambaugh wrote:
Seth,

I managed to let the gdb back trace finish.  It took a while but
here is
the last of the stack up to the last progress dialog dtor iteration. I'm not sure how much good it's going to do.  It looks like there was a context switch or something that corrupted the previous stack frame so
any useful information in that stack frame is lost :(

Wayne

#83262 0x000000006d26fb1d in ?? ()
   from E:\msys64\mingw64\bin\wxmsw30u_core_gcc_custom.dll
#83263 0x00000000806e8547 in
WX_PROGRESS_REPORTER::~WX_PROGRESS_REPORTER (
    this=0x1751aca0, __in_chrg=<optimized out>)
    at
E:/msys64/home/Wayne/src/kicad-5.1/common/widgets/progress_reporter.cpp:117


#83264 0x00000000802d2d88 in POINT_EDITOR::finishItem (this=0x12a8a3a0)
    at
E:/msys64/home/Wayne/src/kicad-5.1/pcbnew/tools/point_editor.cpp:650
#83265 0x00000000802d15a0 in POINT_EDITOR::OnSelectionChange (
    this=0x12a8a3a0, aEvent=...)
    at
E:/msys64/home/Wayne/src/kicad-5.1/pcbnew/tools/point_editor.cpp:427
#83266 0x0000000080bc764f in std::__invoke_impl<int, int
(POINT_EDITOR::*&)(TOOL_EVENT const&), POINT_EDITOR*&, TOOL_EVENT
const&> (__f=
    @0x190138a0: (int (POINT_EDITOR::*)(class POINT_EDITOR * const,
const class TOOL_EVENT &)) 0x802d0b22
<POINT_EDITOR::OnSelectionChange(TOOL_EVENT const&)>, __t=@0x190138b0:
0x12a8a3a0, __args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/invoke.h:73
#83267 0x0000000080c172b3 in std::__invoke<int
(POINT_EDITOR::*&)(TOOL_EVENT const&), POINT_EDITOR*&, TOOL_EVENT
const&> (__fn=
    @0x190138a0: (int (POINT_EDITOR::*)(class POINT_EDITOR * const,
const class TOOL_EVENT &)) 0x802d0b22
<POINT_EDITOR::OnSelectionChange(TOOL_EVENT const&)>,
__args#0=@0x190138b0: 0x12a8a3a0, __args#1=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/invoke.h:95
#83268 0x0000000080ab4fcb in std::_Bind<int
(POINT_EDITOR::*(POINT_EDITOR*, std::_Placeholder<1>))(TOOL_EVENT
const&)>::__call<int, TOOL_EVENT const&, 0ull,
1ull>(std::tuple<TOOL_EVENT const&>&&, std::_Index_tuple<0ull, 1ull>) (
    this=0x190138a0, __args=...)
    at E:/msys64/mingw64/include/c++/9.1.0/functional:400
#83269 0x0000000080ab50f4 in std::_Bind<int
(POINT_EDITOR::*(POINT_EDITOR*, std::_Placeholder<1>))(TOOL_EVENT
const&)>::operator()<TOOL_EVENT const&, int>(TOOL_EVENT const&)
(this=0x190138a0, __args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/functional:484
#83270 0x0000000080a8fef9 in std::_Function_handler<int (TOOL_EVENT
const&), std::_Bind<int (POINT_EDITOR::*(POINT_EDITOR*,
std::_Placeholder<1>))(TOOL_EVENT const&)> >::_M_invoke(std::_Any_data
const&, TOOL_EVENT const&) (
    __functor=..., __args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/std_function.h:285
#83271 0x0000000080a0196b in std::function<int (TOOL_EVENT
const&)>::operator()(TOOL_EVENT const&) const (this=0x19011718,
__args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/std_function.h:690
#83272 0x0000000080958ffa in COROUTINE<int, TOOL_EVENT
const&>::callerStub (
    aData=401672480)
    at E:/msys64/home/Wayne/src/kicad-5.1/include/tool/coroutine.h:332
#83273 0x00000000807b8d4a in make_fcontext ()
   from E:\msys64\mingw64\bin\_pcbnew.kiface
#83274 0x0000000017f10920 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)


On 6/28/2019 7:58 PM, Seth Hillbrand wrote:
Hi Wayne-

I can't get Linux to crash for this bug but I do see some memory
access
grinding when I follow your steps.

Can you test the attached patch and see if it fixes the issue for
you? 
Launchpad is down right now, so I can't attach it to the bug report.

This patch should not be committed to the tree.  If it fixes the
issue,
we can address the root cause but that's a bigger job.

-Seth


References