Update Visualizer accesses to be safer and in the correct order to avoid race conditions#108
Open
bhung-bdai wants to merge 7 commits intorai-opensource:mainfrom
Open
Conversation
…by fixing the floating traces sometimes left in judo
jbruedigam-bdai
approved these changes
Dec 15, 2025
slecleach
approved these changes
Dec 15, 2025
Collaborator
|
I tested it locally on my laptop, I couldn't break the app even with repeated changes of tasks, configs, controller, etc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
Visualizerclass previously had a lot of issues. The two addressed in this PR are the following:Traces being removed AFTER the geometries were removed, not before
Traces are attached to specific geometries. If a geometry is deleted before the trace is deleted, then the trace hangs around until the GUI is remade. This resulted in traces hanging around when you switched from a trace based geometry to a non-trace based geometry, as trace to trace switching would have bodies that the traces could reference before deleting.
This removes the issue by moving the trace removal before the geometry removal
Testing done
cylinder_pushtocaltech_leap_cubewithout seeing traces.Events being recreated when a new task was created
Events and locks were created when a new task was set. This was bad, because you could potentially listen to an event in another process and have it be changed when you set a new task. This results in the event waiting forever, since the new event was not registered to the old listener.
This solves the issue by creating the events once in the
Visualizerconstructor.Testing done
Reorder how we set events
task_update.setandoptimizer_updated.setwere being done in the wrong locations. They were done as soon as the event was received, instead of after theVisualizerhad finished processing. If using an async middleware, this might have resulted in theoptimizer_updatedortask_updatedevent response getting processed before the Visualizer had set up the task properly. In my instance, this resulted in weird viser body geometry states being carried over from a previous instance to the new instance and caused rendering issues.Testing done
The solution is to set the event only after the
Visualizeris done processing.caltech_leap_cubetocylinder_pushwithout seeing weird carryover issues in the rendering process.