Miserlou / RJModules

Various modules for VCV Rack
https://github.com/Miserlou/RJModules
MIT License
99 stars 18 forks source link

Deleting euclidian module crashes Rack [Win 10] #62

Closed SteveRussell33 closed 4 years ago

SteveRussell33 commented 4 years ago

Deleting euclidian module from existing patch or selecting new patch option with euclidian module already added to patch causes crash.

GDB Stack trace:

Thread 1 received signal SIGTRAP, Trace/breakpoint trap. 0x00007ffc5d648907 in ntdll!RtlpNtMakeTemporaryKey () from /c/WINDOWS/SYSTEM32/ntdll.dll (gdb) n Single stepping until exit from function ntdll!RtlpNtMakeTemporaryKey, which has no line number information. 0x00007ffc5d600705 in ntdll!memset () from /c/WINDOWS/SYSTEM32/ntdll.dll (gdb) bt

0 0x00007ffc5d600705 in ntdll!memset () from /c/WINDOWS/SYSTEM32/ntdll.dll

1 0x00007ffc5d647794 in ntdll!RtlpNtMakeTemporaryKey () from /c/WINDOWS/SYSTEM32/ntdll.dll

2 0x00007ffc5d5ede5e in ntdll!memset () from /c/WINDOWS/SYSTEM32/ntdll.dll

3 0x00007ffc5d55286e in ntdll!RtlFreeHeap () from /c/WINDOWS/SYSTEM32/ntdll.dll

4 0x00007ffc5d0d9d0c in msvcrt!free () from /c/WINDOWS/System32/msvcrt.dll

5 0x000000000049d15b in gnu_cxx::new_allocator::deallocate (this=0xd46fec0, p=)

at C:/msys64/mingw64/include/c++/9.2.0/ext/new_allocator.h:119

6 std::allocator_traits<std::allocator >::deallocate (a=..., n=, __p=)

at C:/msys64/mingw64/include/c++/9.2.0/bits/alloc_traits.h:470

7 std::_Vector_base<rack::engine::Light, std::allocator >::_M_deallocate (this=0xd46fec0, n=, p=)

at C:/msys64/mingw64/include/c++/9.2.0/bits/stl_vector.h:351

8 std::_Vector_base<rack::engine::Light, std::allocator >::~_Vector_base (this=0xd46fec0, __in_chrg=)

at C:/msys64/mingw64/include/c++/9.2.0/bits/stl_vector.h:332

9 std::vector<rack::engine::Light, std::allocator >::~vector (this=0xd46fec0, __in_chrg=)

at C:/msys64/mingw64/include/c++/9.2.0/bits/stl_vector.h:680

10 rack::engine::Module::~Module (this=0xd46fe60, __in_chrg=) at src/engine/Module.cpp:12

11 0x00000000134ad362 in plugin!_ZN9EuclidianD0Ev () from /c/Program Files/VCV/v1/plugins-v1/RJModules/plugin.dll

12 0x0000000000492e68 in rack::app::ModuleWidget::setModule (module=0x0, this=0xd32af70) at src/app/ModuleWidget.cpp:422

13 rack::app::ModuleWidget::~ModuleWidget (this=0xd32af70, __in_chrg=) at src/app/ModuleWidget.cpp:250

14 0x000000001346cb07 in plugin!_ZN15EuclidianWidgetD0Ev () from /c/Program Files/VCV/v1/plugins-v1/RJModules/plugin.dll

15 0x000000000048edb3 in rack::app::RackWidget::clear (this=0xd43d640) at src/app/RackWidget.cpp:173

16 0x0000000000487f29 in rack::PatchManager::reset (this=0xd43dc50) at src/patch.cpp:58

17 0x00000000004881c3 in rack::PatchManager::resetDialog (this=0xd43dc50) at src/patch.cpp:82

18 0x00000000004926c8 in rack::app::Scene::onHoverKey (this=0xd43dcd0, e=...) at src/app/Scene.cpp:82

19 0x00000000004590d7 in rack::event::State::handleKey (this=0xd352d90, pos=..., key=, key@entry=78, scancode=scancode@entry=49, action=action@entry=1,

mods=mods@entry=34) at C:/msys64/mingw64/include/c++/9.2.0/bits/stl_iterator.h:137

20 0x0000000000459c7e in rack::keyCallback (win=, key=78, scancode=49, action=1, mods=34) at src/window.cpp:192

21 0x00000000004d9692 in windowProc (hWnd=0xf05cc, uMsg=256, wParam=78, lParam=3211265) at C:/_Projects/VCVRack/V1/Rack/dep/glfw/src/win32_window.c:765

22 0x00007ffc5a97c906 in USER32!DispatchMessageW () from /c/WINDOWS/System32/USER32.dll

23 0x00007ffc5a97c1eb in USER32!CallWindowProcW () from /c/WINDOWS/System32/USER32.dll

24 0x00007ffc3deb1639 in glPushClientAttrib () from /c/WINDOWS/SYSTEM32/OPENGL32.dll

25 0x00007ffc5a97c906 in USER32!DispatchMessageW () from /c/WINDOWS/System32/USER32.dll

26 0x00007ffc5a97c422 in USER32!DispatchMessageW () from /c/WINDOWS/System32/USER32.dll

27 0x00000000004db53e in _glfwPlatformPollEvents () at C:/_Projects/VCVRack/V1/Rack/dep/glfw/src/win32_window.c:1923

28 0x00000000004d485a in glfwPollEvents () at C:/_Projects/VCVRack/V1/Rack/dep/glfw/src/window.c:1072

29 0x0000000000459f36 in rack::Window::run (this=0xd352e80) at src/window.cpp:352

30 0x0000000000783d9d in main (argc=, argv=) at src/main.cpp:203

zeronoises commented 4 years ago

Similar problem: I'm on Manjaro Stable, loading the Euclidean module totally freezes Rack - and it renders thusly: 1577018600

Petervos2018 commented 4 years ago

Same problem here W7

FMTolstoevsky commented 4 years ago

just in case - I confirm this problem for W7

Miserlou commented 4 years ago

Thanks for reporting this! Unfortunately, I'm on OSX and can't reproduce it! Does anybody have any ideas what might be causing this? W32 patches welcome..

midiguru commented 4 years ago

Same result here on Windows 7: Consistent crash when I try to delete it. Perhaps whoever did the Windows build can help track down the problem?

david-c14 commented 4 years ago

I can't see anything obviously wrong with the lights, which is where the stackdump shows the problem.

It may well be a problem elsewhere which is overwriting memory and that then shows up on deallocation.

I would say that it doesn't look safe to me to be manipulating std::string objects in the engine thread (Euclidean::process) and reading them in the ui thread (EuclidianSmallStringDisplayWidget::draw). std::string is not threadsafe unless you ensure that only one thread is trying to access it at any one time.

espenstoro commented 4 years ago

Same on Win 8. It's impossible to delete it, and now a rather big patch is fucked.

midiguru commented 4 years ago

Same on Win 8. It's impossible to delete it, and now a rather big patch is fucked.

I think you can get rid of it by opening the .vcv patch file in a text editor. Patches are stored as plain text. Find the module in the text and delete it. There may be more to the process than that -- I'm not an expert, so you'll need to investigate further before trying it. But I know the text file can be edited.

SteveRussell33 commented 4 years ago

Still crashing as of https://github.com/Miserlou/RJModules/commit/641d95d7b5080d96d922c88967206311c8e997f3

Thread 1 received signal SIGTRAP, Trace/breakpoint trap. 0x00007ff85c498907 in ntdll!RtlpNtMakeTemporaryKey () from /c/WINDOWS/SYSTEM32/ntdll.dll (gdb) bt

0 0x00007ff85c498907 in ntdll!RtlpNtMakeTemporaryKey () from /c/WINDOWS/SYSTEM32/ntdll.dll

1 0x00007ff85c450705 in ntdll!memset () from /c/WINDOWS/SYSTEM32/ntdll.dll

2 0x00007ff85c497794 in ntdll!RtlpNtMakeTemporaryKey () from /c/WINDOWS/SYSTEM32/ntdll.dll

3 0x00007ff85c43de5e in ntdll!memset () from /c/WINDOWS/SYSTEM32/ntdll.dll

4 0x00007ff85c3a286e in ntdll!RtlFreeHeap () from /c/WINDOWS/SYSTEM32/ntdll.dll

5 0x00007ff85b939d0c in msvcrt!free () from /c/WINDOWS/System32/msvcrt.dll

6 0x000000000049d15b in gnu_cxx::new_allocator::deallocate (this=0xd5dc6f0, p=)

at C:/msys64/mingw64/include/c++/9.2.0/ext/new_allocator.h:119

7 std::allocator_traits<std::allocator >::deallocate (a=..., n=, __p=)

at C:/msys64/mingw64/include/c++/9.2.0/bits/alloc_traits.h:470

8 std::_Vector_base<rack::engine::Light, std::allocator >::_M_deallocate (this=0xd5dc6f0, n=, p=)

at C:/msys64/mingw64/include/c++/9.2.0/bits/stl_vector.h:351

9 std::_Vector_base<rack::engine::Light, std::allocator >::~_Vector_base (this=0xd5dc6f0, __in_chrg=)

at C:/msys64/mingw64/include/c++/9.2.0/bits/stl_vector.h:332

10 std::vector<rack::engine::Light, std::allocator >::~vector (this=0xd5dc6f0, __in_chrg=)

at C:/msys64/mingw64/include/c++/9.2.0/bits/stl_vector.h:680

11 rack::engine::Module::~Module (this=0xd5dc690, __in_chrg=) at src/engine/Module.cpp:12

12 0x00000000136fc724 in plugin!_ZN9EuclidianD0Ev () from /c/Program Files/VCV/v1/plugins-v1/RJModules/plugin.dll

13 0x0000000000492e68 in rack::app::ModuleWidget::setModule (module=0x0, this=0xd5cafd0) at src/app/ModuleWidget.cpp:422

14 rack::app::ModuleWidget::~ModuleWidget (this=0xd5cafd0, __in_chrg=) at src/app/ModuleWidget.cpp:250

15 0x0000000013696af8 in plugin!_ZN15EuclidianWidgetD0Ev () from /c/Program Files/VCV/v1/plugins-v1/RJModules/plugin.dll

16 0x000000000048edb3 in rack::app::RackWidget::clear (this=this@entry=0xd59b4d0) at src/app/RackWidget.cpp:173

17 0x000000000048f928 in rack::app::RackWidget::~RackWidget (this=0xd59b4d0, __in_chrg=) at src/app/RackWidget.cpp:100

18 rack::app::RackWidget::~RackWidget (this=0xd59b4d0, __in_chrg=) at src/app/RackWidget.cpp:101

19 0x00000000004a864b in rack::widget::Widget::clearChildren (this=this@entry=0xd59b460) at C:/msys64/mingw64/include/c++/9.2.0/bits/stl_list.h:153

20 0x00000000004a868e in rack::widget::Widget::~Widget (this=0xd59b460, __in_chrg=) at src/widget/Widget.cpp:13

21 0x00000000007737e8 in rack::widget::ZoomWidget::~ZoomWidget (this=0xd59b460, __in_chrg=) at include/widget/ZoomWidget.hpp:10

22 rack::widget::ZoomWidget::~ZoomWidget (this=0xd59b460, __in_chrg=) at include/widget/ZoomWidget.hpp:10

23 0x00000000004a864b in rack::widget::Widget::clearChildren (this=this@entry=0xd596a70) at C:/msys64/mingw64/include/c++/9.2.0/bits/stl_list.h:153

24 0x00000000004a85bb in rack::widget::Widget::~Widget (this=0xd596a70, __in_chrg=) at src/widget/Widget.cpp:13

25 rack::widget::Widget::~Widget (this=0xd596a70, __in_chrg=) at src/widget/Widget.cpp:14

26 rack::widget::Widget::clearChildren (this=this@entry=0xd59b010) at src/widget/Widget.cpp:131

27 0x00000000004a868e in rack::widget::Widget::~Widget (this=0xd59b010, __in_chrg=) at src/widget/Widget.cpp:13

28 0x000000000075a3a8 in rack::widget::OpaqueWidget::~OpaqueWidget (this=0xd59b010, __in_chrg=) at include/widget/OpaqueWidget.hpp:12

29 rack::ui::ScrollWidget::~ScrollWidget (this=0xd59b010, __in_chrg=) at include/ui/ScrollWidget.hpp:12

30 rack::app::RackScrollWidget::~RackScrollWidget (this=0xd59b010, __in_chrg=) at include/app/RackScrollWidget.hpp:12

31 rack::app::RackScrollWidget::~RackScrollWidget (this=0xd59b010, __in_chrg=) at include/app/RackScrollWidget.hpp:12

32 0x00000000004a864b in rack::widget::Widget::clearChildren (this=this@entry=0xd59ad10) at C:/msys64/mingw64/include/c++/9.2.0/bits/stl_list.h:153

33 0x00000000004a868e in rack::widget::Widget::~Widget (this=0xd59ad10, __in_chrg=) at src/widget/Widget.cpp:13

34 0x000000000049233a in rack::widget::OpaqueWidget::~OpaqueWidget (this=0xd59ad10, __in_chrg=) at include/widget/OpaqueWidget.hpp:12

35 rack::app::Scene::~Scene (this=0xd59ad10, __in_chrg=) at src/app/Scene.cpp:45

36 rack::app::Scene::~Scene (this=0xd59ad10, __in_chrg=) at src/app/Scene.cpp:46

37 0x0000000000456c9b in rack::App::~App (this=0xd441b30, __in_chrg=) at src/app.cpp:28

38 0x0000000000456d8f in rack::appDestroy () at src/app.cpp:57

39 0x0000000000783e5e in main (argc=, argv=) at src/main.cpp:214

david-c14 commented 4 years ago

I can confirm that deleting Euclidian crashes on my Ubuntu 16.04 as well. But at least I can compile and run that to try and dig into it a bit log.txt

david-c14 commented 4 years ago

I've raised a pull request with a fix.

SteveRussell33 commented 4 years ago

acd24941be1b7ef2d2a1dfbc7300a31d96ac4e22 is good on Win 10.

Closing.