Skip to content

Commit

Permalink
Fix a whole lot of crashes, all at once (#1780)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk authored Apr 5, 2023
1 parent 409dcd8 commit 5b590bb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
9 changes: 8 additions & 1 deletion crates/re_log_types/src/arrow_msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,14 @@ impl<'de> serde::Deserialize<'de> for ArrowMsg {
(table_id, timepoint_min, buf)
{
let mut cursor = std::io::Cursor::new(buf);
let metadata = read_stream_metadata(&mut cursor).unwrap();
let metadata = match read_stream_metadata(&mut cursor) {
Ok(metadata) => metadata,
Err(err) => {
return Err(serde::de::Error::custom(format!(
"Failed to read stream metadata: {err}"
)))
}
};
let mut stream = StreamReader::new(cursor, metadata, None);
let chunk = stream
.find_map(|state| match state {
Expand Down
4 changes: 2 additions & 2 deletions crates/re_viewer/src/ui/view_text/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use super::ui::ViewTextFilters;
#[derive(Debug, Clone)]
pub struct TextEntry {
// props
pub msg_id: MsgId,
pub msg_id: Option<MsgId>,

pub entity_path: EntityPath,

Expand Down Expand Up @@ -86,7 +86,7 @@ impl SceneText {

if is_visible {
self.text_entries.push(TextEntry {
msg_id: msg_id.unwrap(), // always present
msg_id,
entity_path: entity_path.clone(),
time: time.map(|time| time.as_i64()),
color: color.map(|c| c.to_array()),
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/view_text/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ fn get_time_point(ctx: &ViewerContext<'_>, entry: &TextEntry) -> Option<TimePoin
.log_db
.entity_db
.data_store
.get_msg_metadata(&entry.msg_id)
.get_msg_metadata(&entry.msg_id?)
{
Some(time_point.clone())
} else {
Expand Down
2 changes: 1 addition & 1 deletion crates/re_ws_comms/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ async fn handle_connection(
tcp_stream: TcpStream,
history: Arc<Mutex<Vec<Arc<[u8]>>>>,
) -> tungstenite::Result<()> {
let ws_stream = accept_async(tcp_stream).await.expect("Failed to accept");
let ws_stream = accept_async(tcp_stream).await?;
let (mut ws_sender, mut ws_receiver) = ws_stream.split();

// Re-sending packet history - this is not water tight, but better than nothing.
Expand Down
2 changes: 1 addition & 1 deletion crates/rerun/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ pub fn setup_ctrl_c_handler() -> (tokio::sync::broadcast::Receiver<()>, Arc<Atom
let shutdown = shutdown_return.clone();
ctrlc::set_handler(move || {
re_log::debug!("Ctrl-C detected, shutting down.");
sender.send(()).unwrap();
sender.send(()).ok();
shutdown.store(true, std::sync::atomic::Ordering::Relaxed);
})
.expect("Error setting Ctrl-C handler");
Expand Down

2 comments on commit 5b590bb

@github-actions
Copy link

Choose a reason for hiding this comment

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

Rust Benchmark

Benchmark suite Current: 5b590bb Previous: 409dcd8 Ratio
arrow2/size_bytes/primitive/rows=10000/instances=100/array 150043 ns/iter (± 1364) 144611 ns/iter (± 737) 1.04
arrow2/size_bytes/primitive/rows=10000/instances=100/vec 3307 ns/iter (± 39) 3279 ns/iter (± 175) 1.01
arrow2/size_bytes/primitive/rows=10000/instances=100/vec/erased 17732 ns/iter (± 103) 17727 ns/iter (± 80) 1.00
arrow2/size_bytes/struct/rows=10000/instances=100/array 512893 ns/iter (± 4678) 486559 ns/iter (± 3450) 1.05
arrow2/size_bytes/struct/rows=10000/instances=100/vec 3263 ns/iter (± 45) 3272 ns/iter (± 26) 1.00
arrow2/size_bytes/struct/rows=10000/instances=100/vec/erased 17712 ns/iter (± 113) 17723 ns/iter (± 97) 1.00
arrow2/size_bytes/struct_large/rows=10000/instances=100/array 6680394 ns/iter (± 600723) 3740263 ns/iter (± 351077) 1.79
arrow2/size_bytes/struct_large/rows=10000/instances=100/vec 3979 ns/iter (± 46) 3972 ns/iter (± 30) 1.00
arrow2/size_bytes/struct_large/rows=10000/instances=100/vec/erased 17726 ns/iter (± 121) 17725 ns/iter (± 110) 1.00
arrow2/erased_clone/primitive/rows=10000/instances=100/cell/arc_erased 796342 ns/iter (± 1740) 774326 ns/iter (± 2565) 1.03
arrow2/erased_clone/primitive/rows=10000/instances=100/cell/wrapped_in_arc 201082 ns/iter (± 614) 194025 ns/iter (± 946) 1.04
arrow2/erased_clone/primitive/rows=10000/instances=100/array 778565 ns/iter (± 2262) 743272 ns/iter (± 2029) 1.05
arrow2/erased_clone/primitive/rows=10000/instances=100/array/downcast_first 358346 ns/iter (± 1223) 342474 ns/iter (± 8015) 1.05
arrow2/erased_clone/primitive/rows=10000/instances=100/vec/full_copy 1138316 ns/iter (± 59755) 1033815 ns/iter (± 18611) 1.10
arrow2/erased_clone/primitive/rows=10000/instances=100/vec/wrapped_in_arc 127283 ns/iter (± 276) 129026 ns/iter (± 678) 0.99
arrow2/erased_clone/struct/rows=10000/instances=100/cell/arc_erased 4368854 ns/iter (± 280737) 4178986 ns/iter (± 102394) 1.05
arrow2/erased_clone/struct/rows=10000/instances=100/cell/wrapped_in_arc 278181 ns/iter (± 1586) 278102 ns/iter (± 914) 1.00
arrow2/erased_clone/struct/rows=10000/instances=100/array 4201895 ns/iter (± 101502) 4117849 ns/iter (± 47691) 1.02
arrow2/erased_clone/struct/rows=10000/instances=100/array/downcast_first 3636760 ns/iter (± 103748) 3524450 ns/iter (± 54247) 1.03
arrow2/erased_clone/struct/rows=10000/instances=100/vec/full_copy 1362119 ns/iter (± 39408) 1309611 ns/iter (± 43132) 1.04
arrow2/erased_clone/struct/rows=10000/instances=100/vec/wrapped_in_arc 127034 ns/iter (± 785) 127071 ns/iter (± 569) 1.00
arrow2/erased_clone/struct_large/rows=10000/instances=100/cell/arc_erased 48319119 ns/iter (± 523157) 53662374 ns/iter (± 748809) 0.90
arrow2/erased_clone/struct_large/rows=10000/instances=100/cell/wrapped_in_arc 172047 ns/iter (± 1368) 167897 ns/iter (± 1072) 1.02
arrow2/erased_clone/struct_large/rows=10000/instances=100/array 46667570 ns/iter (± 794783) 50942758 ns/iter (± 815072) 0.92
arrow2/erased_clone/struct_large/rows=10000/instances=100/array/downcast_first 46640788 ns/iter (± 1938447) 48991180 ns/iter (± 774758) 0.95
arrow2/erased_clone/struct_large/rows=10000/instances=100/vec/full_copy 4615572 ns/iter (± 424632) 5000080 ns/iter (± 161800) 0.92
arrow2/erased_clone/struct_large/rows=10000/instances=100/vec/wrapped_in_arc 127327 ns/iter (± 288) 128249 ns/iter (± 586) 0.99
arrow2_convert/serialize/primitive/instances=100000/arrow2_convert 416536 ns/iter (± 500) 413465 ns/iter (± 1707) 1.01
arrow2_convert/serialize/primitive/instances=100000/arrow2/from_values 19493 ns/iter (± 100) 19770 ns/iter (± 152) 0.99
arrow2_convert/serialize/primitive/instances=100000/arrow2/from_vec 19675 ns/iter (± 118) 19496 ns/iter (± 143) 1.01
arrow2_convert/deserialize/primitive/instances=100000/arrow2_convert 96353 ns/iter (± 1415) 98306 ns/iter (± 649) 0.98
arrow2_convert/deserialize/primitive/instances=100000/arrow2/validity_checks 165570 ns/iter (± 1274) 159528 ns/iter (± 461) 1.04
arrow2_convert/deserialize/primitive/instances=100000/arrow2/validity_bypass 58866 ns/iter (± 547) 46314 ns/iter (± 195) 1.27
datastore/num_rows=1000/num_instances=1000/packed=false/insert/default 10990257 ns/iter (± 1070476) 10907764 ns/iter (± 578744) 1.01
datastore/num_rows=1000/num_instances=1000/packed=false/insert/bucketsz=0 16594764 ns/iter (± 917457) 13243988 ns/iter (± 752551) 1.25
datastore/num_rows=1000/num_instances=1000/packed=false/insert/bucketsz=2 16116365 ns/iter (± 1269030) 12415512 ns/iter (± 749794) 1.30
datastore/num_rows=1000/num_instances=1000/packed=false/insert/bucketsz=32 12023144 ns/iter (± 1881206) 11359903 ns/iter (± 539892) 1.06
datastore/num_rows=1000/num_instances=1000/packed=false/insert/bucketsz=2048 10228073 ns/iter (± 722101) 10334816 ns/iter (± 600842) 0.99
datastore/num_rows=1000/num_instances=1000/packed=true/insert/default 13521469 ns/iter (± 1208763) 9959839 ns/iter (± 723412) 1.36
datastore/num_rows=1000/num_instances=1000/packed=true/insert/bucketsz=0 16758492 ns/iter (± 1082213) 11847103 ns/iter (± 721136) 1.41
datastore/num_rows=1000/num_instances=1000/packed=true/insert/bucketsz=2 11717587 ns/iter (± 465784) 11320850 ns/iter (± 530144) 1.04
datastore/num_rows=1000/num_instances=1000/packed=true/insert/bucketsz=32 10336326 ns/iter (± 419146) 9820900 ns/iter (± 447436) 1.05
datastore/num_rows=1000/num_instances=1000/packed=true/insert/bucketsz=2048 10847922 ns/iter (± 1431742) 9577932 ns/iter (± 474252) 1.13
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at/default 1811 ns/iter (± 22) 1828 ns/iter (± 17) 0.99
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at/bucketsz=0 1835 ns/iter (± 30) 1836 ns/iter (± 11) 1.00
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at/bucketsz=2 1860 ns/iter (± 17) 1827 ns/iter (± 11) 1.02
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at/bucketsz=32 1855 ns/iter (± 2) 1848 ns/iter (± 6) 1.00
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at/bucketsz=2048 1843 ns/iter (± 3) 1815 ns/iter (± 16) 1.02
datastore/num_rows=1000/num_instances=1000/packed=true/latest_at/default 1836 ns/iter (± 24) 1826 ns/iter (± 49) 1.01
datastore/num_rows=1000/num_instances=1000/packed=true/latest_at/bucketsz=0 1839 ns/iter (± 7) 1831 ns/iter (± 9) 1.00
datastore/num_rows=1000/num_instances=1000/packed=true/latest_at/bucketsz=2 1832 ns/iter (± 12) 1825 ns/iter (± 12) 1.00
datastore/num_rows=1000/num_instances=1000/packed=true/latest_at/bucketsz=32 1814 ns/iter (± 11) 1822 ns/iter (± 9) 1.00
datastore/num_rows=1000/num_instances=1000/packed=true/latest_at/bucketsz=2048 1801 ns/iter (± 11) 1803 ns/iter (± 8) 1.00
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/primary/default 280 ns/iter (± 0) 280 ns/iter (± 1) 1
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/secondaries/default 436 ns/iter (± 0) 434 ns/iter (± 1) 1.00
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/primary/bucketsz=0 281 ns/iter (± 0) 280 ns/iter (± 1) 1.00
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/secondaries/bucketsz=0 444 ns/iter (± 0) 444 ns/iter (± 2) 1
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/primary/bucketsz=2 281 ns/iter (± 0) 281 ns/iter (± 1) 1
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/secondaries/bucketsz=2 442 ns/iter (± 0) 441 ns/iter (± 3) 1.00
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/primary/bucketsz=32 281 ns/iter (± 0) 281 ns/iter (± 1) 1
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/secondaries/bucketsz=32 438 ns/iter (± 2) 438 ns/iter (± 2) 1
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/primary/bucketsz=2048 281 ns/iter (± 0) 281 ns/iter (± 1) 1
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/secondaries/bucketsz=2048 434 ns/iter (± 0) 434 ns/iter (± 1) 1
datastore/num_rows=1000/num_instances=1000/packed=true/latest_at_missing/primary/default 280 ns/iter (± 0) 281 ns/iter (± 1) 1.00
datastore/num_rows=1000/num_instances=1000/packed=true/latest_at_missing/secondaries/default 436 ns/iter (± 0) 433 ns/iter (± 1) 1.01
datastore/num_rows=1000/num_instances=1000/packed=true/latest_at_missing/primary/bucketsz=0 280 ns/iter (± 0) 281 ns/iter (± 0) 1.00
datastore/num_rows=1000/num_instances=1000/packed=true/latest_at_missing/secondaries/bucketsz=0 441 ns/iter (± 1) 441 ns/iter (± 3) 1
datastore/num_rows=1000/num_instances=1000/packed=true/latest_at_missing/primary/bucketsz=2 280 ns/iter (± 0) 281 ns/iter (± 1) 1.00
datastore/num_rows=1000/num_instances=1000/packed=true/latest_at_missing/secondaries/bucketsz=2 441 ns/iter (± 1) 442 ns/iter (± 0) 1.00
datastore/num_rows=1000/num_instances=1000/packed=true/latest_at_missing/primary/bucketsz=32 280 ns/iter (± 1) 281 ns/iter (± 0) 1.00
datastore/num_rows=1000/num_instances=1000/packed=true/latest_at_missing/secondaries/bucketsz=32 438 ns/iter (± 0) 441 ns/iter (± 1) 0.99
datastore/num_rows=1000/num_instances=1000/packed=true/latest_at_missing/primary/bucketsz=2048 281 ns/iter (± 0) 281 ns/iter (± 0) 1
datastore/num_rows=1000/num_instances=1000/packed=true/latest_at_missing/secondaries/bucketsz=2048 434 ns/iter (± 0) 434 ns/iter (± 0) 1
datastore/num_rows=1000/num_instances=1000/packed=false/range/default 15663274 ns/iter (± 827787) 11601059 ns/iter (± 755926) 1.35
datastore/num_rows=1000/num_instances=1000/packed=false/range/bucketsz=0 2432913 ns/iter (± 475938) 2195118 ns/iter (± 10644) 1.11
datastore/num_rows=1000/num_instances=1000/packed=false/range/bucketsz=2 2562730 ns/iter (± 505647) 2149409 ns/iter (± 10463) 1.19
datastore/num_rows=1000/num_instances=1000/packed=false/range/bucketsz=32 2096058 ns/iter (± 244852) 1957310 ns/iter (± 9486) 1.07
datastore/num_rows=1000/num_instances=1000/packed=false/range/bucketsz=2048 1900002 ns/iter (± 21745) 1942792 ns/iter (± 8442) 0.98
datastore/num_rows=1000/num_instances=1000/packed=true/range/default 10886728 ns/iter (± 1429474) 10079824 ns/iter (± 516478) 1.08
datastore/num_rows=1000/num_instances=1000/packed=true/range/bucketsz=0 2138189 ns/iter (± 47139) 2146195 ns/iter (± 10868) 1.00
datastore/num_rows=1000/num_instances=1000/packed=true/range/bucketsz=2 2100353 ns/iter (± 21050) 2126992 ns/iter (± 8869) 0.99
datastore/num_rows=1000/num_instances=1000/packed=true/range/bucketsz=32 1844029 ns/iter (± 10784) 1832680 ns/iter (± 12533) 1.01
datastore/num_rows=1000/num_instances=1000/packed=true/range/bucketsz=2048 1804063 ns/iter (± 137004) 1896355 ns/iter (± 7323) 0.95
vector_ops/sort/instances=10000/smallvec/n=4 12387 ns/iter (± 149) 12497 ns/iter (± 52) 0.99
vector_ops/sort/instances=10000/tinyvec/n=4 9621 ns/iter (± 81) 9647 ns/iter (± 20) 1.00
vector_ops/sort/instances=10000/vec 9667 ns/iter (± 26) 9594 ns/iter (± 86) 1.01
vector_ops/split_off/instances=10000/smallvec/n=4/manual 5559 ns/iter (± 86) 5545 ns/iter (± 48) 1.00
vector_ops/split_off/instances=10000/tinyvec/n=4 2734 ns/iter (± 27) 2734 ns/iter (± 32) 1
vector_ops/split_off/instances=10000/tinyvec/n=4/manual 2682 ns/iter (± 48) 2715 ns/iter (± 31) 0.99
vector_ops/split_off/instances=10000/vec 2711 ns/iter (± 35) 2726 ns/iter (± 14) 0.99
vector_ops/split_off/instances=10000/vec/manual 2721 ns/iter (± 39) 2729 ns/iter (± 47) 1.00
vector_ops/swap/instances=10000/smallvec/n=4 32751 ns/iter (± 151) 32768 ns/iter (± 189) 1.00
vector_ops/swap/instances=10000/tinyvec/n=4 18207 ns/iter (± 318) 18283 ns/iter (± 106) 1.00
vector_ops/swap/instances=10000/vec 12221 ns/iter (± 151) 12312 ns/iter (± 60) 0.99
vector_ops/swap_opt/instances=10000/smallvec/n=4 42443 ns/iter (± 481) 42627 ns/iter (± 60) 1.00
vector_ops/swap_opt/instances=10000/tinyvec/n=4 28409 ns/iter (± 313) 28709 ns/iter (± 121) 0.99
vector_ops/swap_opt/instances=10000/vec 20449 ns/iter (± 164) 19767 ns/iter (± 85) 1.03
mono_points_arrow/generate_message_bundles 43671581 ns/iter (± 927866) 43605456 ns/iter (± 1164749) 1.00
mono_points_arrow/generate_messages 135982388 ns/iter (± 1816127) 148523816 ns/iter (± 1268915) 0.92
mono_points_arrow/encode_log_msg 178919766 ns/iter (± 5005485) 182820883 ns/iter (± 976989) 0.98
mono_points_arrow/encode_total 369750999 ns/iter (± 6173238) 373913691 ns/iter (± 1920910) 0.99
mono_points_arrow/decode_log_msg 217149510 ns/iter (± 2515296) 222652848 ns/iter (± 1214307) 0.98
mono_points_arrow/decode_message_bundles 76138701 ns/iter (± 1634733) 78397309 ns/iter (± 1396723) 0.97
mono_points_arrow/decode_total 294965128 ns/iter (± 8190616) 302734874 ns/iter (± 1594490) 0.97
mono_points_arrow_batched/generate_message_bundles 39964749 ns/iter (± 1738867) 35291866 ns/iter (± 1598406) 1.13
mono_points_arrow_batched/generate_messages 8939607 ns/iter (± 1846417) 6636509 ns/iter (± 370819) 1.35
mono_points_arrow_batched/encode_log_msg 1526675 ns/iter (± 36663) 1548938 ns/iter (± 4702) 0.99
mono_points_arrow_batched/encode_total 50335189 ns/iter (± 2623579) 43078984 ns/iter (± 1879119) 1.17
mono_points_arrow_batched/decode_log_msg 867745 ns/iter (± 5643) 867411 ns/iter (± 4318) 1.00
mono_points_arrow_batched/decode_message_bundles 13006391 ns/iter (± 924224) 10705835 ns/iter (± 231298) 1.21
mono_points_arrow_batched/decode_total 14655208 ns/iter (± 728800) 11731931 ns/iter (± 379412) 1.25
batch_points_arrow/generate_message_bundles 308824 ns/iter (± 1442) 297581 ns/iter (± 1225) 1.04
batch_points_arrow/generate_messages 5805 ns/iter (± 19) 5743 ns/iter (± 21) 1.01
batch_points_arrow/encode_log_msg 383625 ns/iter (± 4574) 376972 ns/iter (± 1079) 1.02
batch_points_arrow/encode_total 735814 ns/iter (± 5088) 709235 ns/iter (± 4213) 1.04
batch_points_arrow/decode_log_msg 349184 ns/iter (± 5836) 350094 ns/iter (± 1090) 1.00
batch_points_arrow/decode_message_bundles 2219 ns/iter (± 9) 2195 ns/iter (± 15) 1.01
batch_points_arrow/decode_total 352115 ns/iter (± 3171) 367378 ns/iter (± 1843) 0.96
arrow_mono_points/insert 6736330003 ns/iter (± 30219040) 6870259699 ns/iter (± 67605864) 0.98
arrow_mono_points/query 1855142 ns/iter (± 59868) 1793672 ns/iter (± 14447) 1.03
arrow_batch_points/insert 3055816 ns/iter (± 32122) 3025932 ns/iter (± 11517) 1.01
arrow_batch_points/query 16452 ns/iter (± 28) 16430 ns/iter (± 90) 1.00
arrow_batch_vecs/insert 43641 ns/iter (± 185) 42663 ns/iter (± 265) 1.02
arrow_batch_vecs/query 507022 ns/iter (± 1195) 505652 ns/iter (± 3474) 1.00
tuid/Tuid::random 34 ns/iter (± 0) 34 ns/iter (± 0) 1

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: 5b590bb Previous: 409dcd8 Ratio
arrow2/size_bytes/struct_large/rows=10000/instances=100/array 6680394 ns/iter (± 600723) 3740263 ns/iter (± 351077) 1.79

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.