Fix transforms & videos breaking when receiving new data in the background#12452
Fix transforms & videos breaking when receiving new data in the background#12452
Conversation
|
Web viewer built successfully.
View image diff on kitdiff. Note: This comment is updated whenever you push a commit. |
emilk
left a comment
There was a problem hiding this comment.
The original problem is that not all store events reach all the cashes.
For instance, it seems like the transform cache relies on knowing about all store additions:
rerun/crates/store/re_tf/src/transform_resolution_cache.rs
Lines 957 to 961 in fdbe7d3
It seems like Cache::on_store_events were added in other to be able to selectively invalidate on store deletions, but some caches abuse it to also look as store additions, effectively becoming store subscribers rather than caches.
Unless we change the interface of trait Cache to explicitly only pass deletions, then we must face the possibility that some "caches" will need to get all store events, and not just some of them.
so but if we don't have a cache to begin with it should work fine since upon initial creation of any of these caches we restore all the data from the store. So I do think this is a viable approach! Relevant "examples":
I meant to draft this PR though since I didn't have a repro before/after yet as noted on Slack, that's an oversight on my part! |
…round This discards unused caches if their stores receives new data, rationale in the comment
a0b6dbc to
a65732f
Compare
Oh I missed that! Then this should work. I will try to repro and test |
|
I created this issue, which may be related: https://linear.app/rerun/issue/RR-3342/debug-crash-video-santity-check |
emilk
left a comment
There was a problem hiding this comment.
Me and @Wumpf reproed the problem like so:
diff --git a/docs/snippets/all/archetypes/transform3d_hierarchy_frames.py b/docs/snippets/all/archetypes/transform3d_hierarchy_frames.py
index 9aa3ab4acf..f2b03fd1f4 100644
--- a/docs/snippets/all/archetypes/transform3d_hierarchy_frames.py
+++ b/docs/snippets/all/archetypes/transform3d_hierarchy_frames.py
@@ -1,5 +1,6 @@
"""Logs a transform hierarchy using named transform frame relationships."""
+import time
import numpy as np
import rerun as rr
@@ -22,6 +23,10 @@ rr.log(
rr.CoordinateFrame("sun_frame"),
)
+print("Sleeping…")
+time.sleep(3.0)
+print("Slept")
+
rr.log(
"planet",
rr.Ellipsoids3D(
(base) (switch away from the recording during the sleep).
And this PR fixes the problem!
|
as discussed: alternative approach of always updating the caches. Confirmed with above snippet |
Related
What
This keeps all caches up to date.
We first tried discarding them which also worked fine, but decided to go with keeping things up to date since most likely those recordings are still in used. If it gets too much memory used, GC will do.