hugoam / two

c++ toolkit for rapid development of live graphical apps and games
zlib License
1.68k stars 92 forks source link

sysmalloc assertion failure #16

Open pgruenbacher opened 5 years ago

pgruenbacher commented 5 years ago

Ubuntu 18 bgfx works for me for the most part. a lot of the compiled scenes will fail. e.g. 08_sky_d, xx_three_d, etc.

[info] ui - window init - resource path /home/pgruenbacher/Code/cpp/two/data
[info] ui - loading images from path /home/pgruenbacher/Code/cpp/two/data/interface/uisprites
[info] ui - loading resources
[info] ui - init input
[info] ui window - resize to (1600, 900) - pixel size (1600, 900)
[warning] ui - style TypeLabel not found
[warning] ui - style TypeLabel not found
[warning] ui - style Tree not found
[warning] ui - style Dockbox not found
[warning] ui - style Section not found
[warning] ui - style Dockbox not found
08_sky_d: malloc.c:2401: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

I'll try a quick investigation.

pgruenbacher commented 5 years ago
==23574== Invalid write of size 8
==23574==    at 0x198F05: stl::vector<two::v3<float>, stl::allocator>::vector() (vector.hpp:25)
==23574==    by 0x1A6EFF: two::Buffer::Buffer() (ImporterPly.cpp:173)
==23574==    by 0x1B32AA: two::TBuffer<two::Tonemap>::TBuffer(two::Type&, int) (Buffer.h:41)
==23574==    by 0x1B2821: stl::unique_ptr<two::TBuffer<two::Tonemap> > two::construct<two::TBuffer<two::Tonemap>, two::Type&>(two::Type&) (memory.h:121)
==23574==    by 0x1B164C: void two::BufferArray::add_buffer<two::Tonemap>() (ECS.hpp:79)
==23574==    by 0x1AF86C: void two::BufferArray::init<two::Tonemap, two::BCS, two::Glow, two::DofBlur>() (ECS.hpp:90)
==23574==    by 0x1AB7B0: two::pipeline_pbr(two::GfxSystem&, two::Renderer&, bool) (PipelinePbr.cpp:226)
==23574==    by 0x1E767B: two::GfxSystem::init_pipeline(void (*)(two::GfxSystem&, two::Renderer&, bool)) (GfxSystem.cpp:211)
==23574==    by 0x181F9E: main (02_camera.cpp:34)
hugoam commented 5 years ago

Thanks for the report! Looks like what I thought was an Emscripten issue is actually a general issue, but I couldn't find the cause yet. Until I understand what's going on, commenting out that line should allow the samples that don't use Tonemap or Glow etc to work: https://github.com/hugoam/two/blob/master/src/gfx-pbr/PipelinePbr.cpp#L226

pgruenbacher commented 5 years ago

I had commented and got later segfault actually, but I'll wait.

hugoam commented 5 years ago

Interested in the stacktrace of the next one, if you don't mind!

pgruenbacher commented 5 years ago

Sure. On a side thought I wish there was like a travis ci for graphics testing. Like with frame snapshots all collated together.

pgruenbacher commented 5 years ago

after commenting out https://github.com/hugoam/two/blob/master/src/gfx-pbr/PipelinePbr.cpp#L226

[info] gfx - compiling shader : /home/pgruenbacher/Code/cpp/two/data/shaders/pbr/pbr_fs.sc
[info] gfx - defines : SHADOWS;PCF_LEVEL=0;DIFFUSE_MODE=0;SPECULAR_MODE=0;MAX_LIGHTS=64;MAX_SHADOWS=32;
[info] gfx - loading program pbr/pbr_v65536 with options SHADOWS;PCF_LEVEL=0;DIFFUSE_MODE=0;SPECULAR_MODE=0;MAX_LIGHTS=64;MAX_SHADOWS=32;
==4023== Invalid read of size 8
==4023==    at 0x1B1C0E: stl::vector<two::BCS, stl::allocator>::operator[](unsigned long) (vector.h:57)
==4023==    by 0x1B0E86: two::BCS& two::BufferArray::get<two::BCS>(unsigned int) (ECS.hpp:157)
==4023==    by 0x1AF52E: two::BCS& two::Entt::comp<two::BCS>() (ECS.hpp:195)
==4023==    by 0x1ACA4B: two::pass_post_auto(two::GfxSystem&, two::Render&) (PipelinePbr.cpp:523)
==4023==    by 0x1ABB24: two::render_pbr_forward(two::GfxSystem&, two::Render&) (PipelinePbr.cpp:308)
==4023==    by 0x20C00B: two::Renderer::render(two::Render&, void (*)(two::GfxSystem&, two::Render&)) (Renderer.cpp:208)
==4023==    by 0x20BF3F: two::Renderer::submit(two::Render&, void (*)(two::GfxSystem&, two::Render&)) (Renderer.cpp:189)
==4023==    by 0x1E50BC: two::GfxSystem::render(two::Shading, void (*)(two::GfxSystem&, two::Render&), two::RenderTarget&, two::Viewport&) (GfxSystem.cpp:343)
==4023==    by 0x1E4E0E: two::GfxSystem::render_contexts() (GfxSystem.cpp:299)
==4023==    by 0x18A7CD: two::Shell::end_frame() (Shell.cpp:118)
==4023==    by 0x18A886: two::Shell::pump() (Shell.cpp:130)
==4023==    by 0x18A759: two::Shell::run(void (* const&)(two::Shell&, two::ShellWindow&), unsigned long) (Shell.cpp:106)
==4023==  Address 0x10 is not stack'd, malloc'd or (recently) free'd
pgruenbacher commented 5 years ago

also caught this...

==4023== Conditional jump or move depends on uninitialised value(s)
==4023==    at 0x2913C3: two::Frame::inside(two::v2<float> const&) (Frame.cpp:254)
==4023==    by 0x2B4E7B: two::pinpoint(two::Frame&, two::v2<float>, bool (* const&)(two::Frame&)) (WidgetStruct.cpp:30)
==4023==    by 0x2B5896: two::Widget::pinpoint(two::v2<float>, bool (* const&)(two::Frame&)) (WidgetStruct.cpp:149)
==4023==    by 0x2B5847: two::Widget::pinpoint(two::v2<float>) (WidgetStruct.cpp:144)
==4023==    by 0x2B599E: two::Widget::control_event(two::InputEvent&) (WidgetStruct.cpp:172)
==4023==    by 0x186740: two::EventDispatcher::dispatch_event(two::InputEvent&, two::ControlNode*) (InputDispatcher.cpp:57)
==4023==    by 0x184E63: two::Mouse::dispatch_event(two::MouseEvent) (InputDevice.cpp:114)
==4023==    by 0x184F8F: two::Mouse::heartbeat() (InputDevice.cpp:129)
==4023==    by 0x2B2CAE: two::Ui::input_frame() (UiRoot.cpp:47)
==4023==    by 0x2B3CFF: two::UiWindow::input_frame() (UiWindow.cpp:153)
==4023==    by 0x18A541: two::ShellWindow::begin_frame() (Shell.cpp:64)
==4023==    by 0x1E4CF2: two::GfxSystem::begin_frame() (GfxSystem.cpp:272)
==4023==