rerun icon indicating copy to clipboard operation
rerun copied to clipboard

Logging a point with a negative radius crashes the viewer

Open jleibs opened this issue 2 years ago • 1 comments

To repro modify any example that logs points to include "radii=-1"

thread '<unnamed>' panicked at 'Bad size: -1', /home/jleibs/rerun/crates/re_renderer/src/size.rs:26:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/panicking.rs:64:14
   2: re_renderer::size::Size::new_scene
             at ./crates/re_renderer/src/size.rs:26:9
   3: re_viewer::ui::view_spatial::scene::scene_part::points3d::Points3DPart::process_radii::{{closure}}::{{closure}}
             at ./crates/re_viewer/src/ui/view_spatial/scene/scene_part/points3d.rs:111:56
   4: core::option::Option<T>::map_or
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/option.rs:988:24
   5: re_viewer::ui::view_spatial::scene::scene_part::points3d::Points3DPart::process_radii::{{closure}}
             at ./crates/re_viewer/src/ui/view_spatial/scene/scene_part/points3d.rs:111:21
   6: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/ops/function.rs:629:13
   7: core::option::Option<T>::map
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/option.rs:925:29
   8: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/iter/adapters/map.rs:103:9
   9: <core::iter::adapters::zip::Zip<A,B> as core::iter::adapters::zip::ZipImpl<A,B>>::next
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/iter/adapters/zip.rs:155:21
  10: <core::iter::adapters::zip::Zip<A,B> as core::iter::traits::iterator::Iterator>::next
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/iter/adapters/zip.rs:84:9
  11: re_renderer::point_cloud_builder::PointsBuilder<PerPointUserData>::radii
             at ./crates/re_renderer/src/point_cloud_builder.rs:318:32
  12: re_viewer::ui::view_spatial::scene::scene_part::points3d::Points3DPart::process_entity_view
             at ./crates/re_viewer/src/ui/view_spatial/scene/scene_part/points3d.rs:201:9
  13: <re_viewer::ui::view_spatial::scene::scene_part::points3d::Points3DPart as re_viewer::ui::view_spatial::scene::scene_part::ScenePart>::load::{{closure}}
             at ./crates/re_viewer/src/ui/view_spatial/scene/scene_part/points3d.rs:252:21
  14: core::result::Result<T,E>::and_then
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/result.rs:1372:22
  15: <re_viewer::ui::view_spatial::scene::scene_part::points3d::Points3DPart as re_viewer::ui::view_spatial::scene::scene_part::ScenePart>::load
             at ./crates/re_viewer/src/ui/view_spatial/scene/scene_part/points3d.rs:234:19
  16: re_viewer::ui::view_spatial::scene::SceneSpatial::load
             at ./crates/re_viewer/src/ui/view_spatial/scene/mod.rs:180:13
  17: re_viewer::ui::space_view::SpaceView::scene_ui
             at ./crates/re_viewer/src/ui/space_view.rs:180:17
  18: re_viewer::ui::viewport::space_view_ui
             at ./crates/re_viewer/src/ui/viewport.rs:767:5
  19: <re_viewer::ui::viewport::TabViewer as egui_dock::TabViewer>::ui
             at ./crates/re_viewer/src/ui/viewport.rs:653:9
  20: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/alloc/src/boxed.rs:2000:9
  21: egui::containers::frame::Frame::show_dyn
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/containers/frame.rs:220:19
  22: egui::containers::frame::Frame::show
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/containers/frame.rs:211:9
  23: egui_dock::DockArea<Tab>::show_inside::{{closure}}
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui_dock-0.4.0/src/lib.rs:572:29
  24: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/ops/function.rs:507:5
  25: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/alloc/src/boxed.rs:2000:9
  26: egui::ui::Ui::scope_dyn
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/ui.rs:1732:19
  27: egui::ui::Ui::push_id
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/ui.rs:1704:9
  28: egui_dock::DockArea<Tab>::show_inside
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui_dock-0.4.0/src/lib.rs:555:21
  29: re_viewer::ui::viewport::Viewport::viewport_ui::{{closure}}
             at ./crates/re_viewer/src/ui/viewport.rs:439:13
  30: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/ops/function.rs:507:5
  31: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/alloc/src/boxed.rs:2000:9
  32: egui::ui::Ui::scope_dyn
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/ui.rs:1732:19
  33: egui::ui::Ui::scope
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/ui.rs:1720:9
  34: re_viewer::ui::viewport::Viewport::viewport_ui
             at ./crates/re_viewer/src/ui/viewport.rs:434:9
  35: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/alloc/src/boxed.rs:2000:9
  36: egui::containers::panel::CentralPanel::show_inside_dyn::{{closure}}
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/containers/panel.rs:1024:13
  37: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/ops/function.rs:507:5
  38: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/alloc/src/boxed.rs:2000:9
  39: egui::containers::frame::Frame::show_dyn
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/containers/frame.rs:220:19
  40: egui::containers::frame::Frame::show
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/containers/frame.rs:211:9
  41: egui::containers::panel::CentralPanel::show_inside_dyn
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/containers/panel.rs:1022:9
  42: egui::containers::panel::CentralPanel::show_inside
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/containers/panel.rs:1007:9
  43: re_viewer::ui::blueprint::Blueprint::blueprint_panel_and_viewport
             at ./crates/re_viewer/src/ui/blueprint.rs:42:9
  44: re_viewer::app::AppState::show::{{closure}}
             at ./crates/re_viewer/src/app.rs:948:45
  45: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/ops/function.rs:507:5
  46: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/alloc/src/boxed.rs:2000:9
  47: egui::containers::panel::CentralPanel::show_inside_dyn::{{closure}}
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/containers/panel.rs:1024:13
  48: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/ops/function.rs:507:5
  49: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/alloc/src/boxed.rs:2000:9
  50: egui::containers::frame::Frame::show_dyn
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/containers/frame.rs:220:19
  51: egui::containers::frame::Frame::show
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/containers/frame.rs:211:9
  52: egui::containers::panel::CentralPanel::show_inside_dyn
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/containers/panel.rs:1022:9
  53: egui::containers::panel::CentralPanel::show_inside
             at /home/jleibs/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.21.0/src/containers/panel.rs:1007:9
  54: re_viewer::app::AppState::show
             at ./crates/re_viewer/src/app.rs:945:9

jleibs avatar Feb 12 '23 14:02 jleibs

Hey @emilk first time contributor here. Can I take this up? Any pointers would be awesome

satya-nutella avatar Feb 16 '23 06:02 satya-nutella

@meehawk sorry for the slow reply - I missed your comment!

There are at least two things to fix here:

  • Input-validation: the Python SDK should log a warning (_send_warning) when users use a negative radius
  • The viewer should never ever crash, so we should also in the viewer log a warning with re_log::warn_once and then do some sane fallback, like ignoring the point.

emilk avatar Feb 28 '23 16:02 emilk