Skip to content

Add check while trying to remove uninserted Ids #782

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

Merged
merged 1 commit into from
Jul 11, 2020

Conversation

kunalmohan
Copy link
Contributor

@kunalmohan kunalmohan commented Jul 11, 2020

Connections
Link to the issues addressed by this PR, or dependent PRs in other repositories
An attempt to fix #781
regression from #776

Description
Describe what problem this is solving, and how it's solved.
When we used VecMap, it simply returned None for even out of bounds access to the map (We depended on it returning None). After #776 , we get a panic. So adding a simple index check before accessing it fixes this issue.

Testing
Explain how this change is tested.
Tested on wgpu-rs examples with the changes in gfx-rs/wgpu-rs#430. All examples run fine except the cube which segfaults.

Copy link
Contributor

@monocodus monocodus bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .monocodus config not found in your repo. Default config is used.
Check config documentation here

Copy link
Contributor

@monocodus monocodus bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .monocodus config not found in your repo. Default config is used.
Check config documentation here

@kunalmohan
Copy link
Contributor Author

@kvark r?

I'll try to investigate the segfault.

@kunalmohan
Copy link
Contributor Author

gdb output for the segfault-

Thread 1 "cube" received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) list
342	            rpass.set_pipeline(&self.pipeline);
343	            rpass.set_bind_group(0, &self.bind_group, &[]);
344	            rpass.set_index_buffer(self.index_buf.slice(..));
345	            rpass.set_vertex_buffer(0, self.vertex_buf.slice(..));
346	            rpass.pop_debug_group();
347	            rpass.insert_debug_marker("Draw!");
348	            rpass.draw_indexed(0..self.index_count as u32, 0, 0..1);
349	        }
350	
351	        queue.submit(Some(encoder.finish()));
(gdb) where
#0  0x0000000000000000 in ?? ()
#1  0x0000555555e64706 in ash::vk::extensions::ExtDebugUtilsFn::cmd_begin_debug_utils_label_ext (self=0x555556a4b418, command_buffer=..., p_label_info=0x7fffffff3e70)
    at /home/kunal/.cargo/registry/src/github.com-1ecc6299db9ec823/ash-0.31.0/src/vk/extensions.rs:10385
#2  0x0000555555e6a59f in ash::extensions::ext::debug_utils::DebugUtils::cmd_begin_debug_utils_label (self=0x555556a4b410, command_buffer=..., label=0x7fffffff3e70)
    at /home/kunal/.cargo/registry/src/github.com-1ecc6299db9ec823/ash-0.31.0/src/extensions/ext/debug_utils.rs:65
#3  0x0000555555e1a9c2 in <gfx_backend_vulkan::command::CommandBuffer as gfx_hal::command::CommandBuffer<gfx_backend_vulkan::Backend>>::begin_debug_marker (self=0x7fffffff5ae8, name=..., 
    color=0) at /home/kunal/.cargo/registry/src/github.com-1ecc6299db9ec823/gfx-backend-vulkan-0.5.10/src/command.rs:1029
#4  0x0000555555b7589d in wgpu_core::command::render::<impl wgpu_core::hub::Global<G>>::command_encoder_run_render_pass_impl (self=0x5555568bb580, encoder_id=..., base=..., 
    color_attachments=..., depth_stencil_attachment=...) at /mnt/2C0057330057036E/Documents/web/rust/wgpu/wgpu-core/src/command/render.rs:1356
#5  0x0000555555b6b83f in wgpu_core::command::render::<impl wgpu_core::hub::Global<G>>::command_encoder_run_render_pass (self=0x5555568bb580, encoder_id=..., pass=0x7fffffffa048)
    at /mnt/2C0057330057036E/Documents/web/rust/wgpu/wgpu-core/src/command/render.rs:350
#6  0x000055555598ad4d in wgpu::backend::direct::<impl wgpu::Context for wgpu_core::hub::Global<wgpu_core::hub::IdentityManagerFactory>>::command_encoder_end_render_pass (
    self=0x5555568bb580, encoder=0x7fffffffa040, pass=0x7fffffffa048) at src/backend/direct.rs:1005
#7  0x000055555594a4bf in <wgpu::RenderPass as core::ops::drop::Drop>::drop (self=0x7fffffffa048) at src/lib.rs:2022
#8  0x00005555556a3cc7 in core::ptr::drop_in_place () at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7/src/libcore/ptr/mod.rs:177
#9  0x00005555556d24d6 in <cube::Example as cube::framework::Example>::render (self=0x7fffffffb2e8, frame=0x7fffffffa680, device=0x7fffffffb400, queue=0x7fffffffb410, 
    _spawner=0x7fffffffb438) at examples/cube/main.rs:349
#10 0x00005555556b908e in cube::framework::start::{{closure}} (event=..., control_flow=0x7fffffffaa20) at examples/cube/../framework.rs:269
#11 0x00005555556f0f33 in winit::platform_impl::platform::sticky_exit_callback (evt=..., target=0x555556869c20, control_flow=0x7fffffffaa20, callback=0x7fffffffb220)
    at /home/kunal/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.22.1/src/platform_impl/linux/mod.rs:698
#12 0x00005555556f7577 in winit::platform_impl::platform::x11::EventLoop<T>::run_return (self=0x7fffffffbd48, callback=...)
    at /home/kunal/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.22.1/src/platform_impl/linux/x11/mod.rs:312
#13 0x00005555556f855b in winit::platform_impl::platform::x11::EventLoop<T>::run (self=..., callback=...)
    at /home/kunal/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.22.1/src/platform_impl/linux/x11/mod.rs:390
#14 0x00005555556f0cd2 in winit::platform_impl::platform::EventLoop<T>::run (self=..., callback=...)
    at /home/kunal/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.22.1/src/platform_impl/linux/mod.rs:645
#15 0x0000555555700c94 in winit::event_loop::EventLoop<T>::run (self=..., event_handler=...)
    at /home/kunal/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.22.1/src/event_loop.rs:149
#16 0x00005555556b8576 in cube::framework::start () at examples/cube/../framework.rs:203
#17 0x00005555556b91ad in cube::framework::run (title=...) at examples/cube/../framework.rs:279
#18 0x00005555556ee665 in cube::main () at examples/cube/main.rs:356

Not sure if this is related to #776

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!
bors r+

@bors
Copy link
Contributor

bors bot commented Jul 11, 2020

@bors bors bot merged commit 6f48482 into gfx-rs:master Jul 11, 2020
@kunalmohan kunalmohan deleted the remove-error branch July 12, 2020 05:03
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

Successfully merging this pull request may close these issues.

Panic in Storage::remove
2 participants