viser icon indicating copy to clipboard operation
viser copied to clipboard

Calling `MeshHandleObject.remove()` on a mesh of size ~3.0 MB causes the program to hang

Open bhung-bdai opened this issue 11 months ago • 2 comments

Hi,

I've noticed that calling the MeshHandleObject.remove() function on larger sized meshes (in this case, around 3 MB) is causing the program to hang. As part of my code, I have a function which resets the visualizer by calling SceneNodeHandleInheritedObject.remove() on each handle in the scene. It deletes things like sliders, buttons, and small meshes fine but stalls out when it comes to deleting the bigger mesh. Is there a solution to make this work? If I am resetting a scene, is there a faster way to do it?

Example of stalling. The below has 26 SceneNodeHandles but only gets to deleting 16 of them: image

Notable, when I CTRL-C it, it interrupts this deletion and continues to to delete as expected.

I've gotten around the problem at the moment by not deleting MeshHandle types since it seems to be reset when when the Scene is reset anyways, but I'm not sure if this is the right solution. Any pointers?

bhung-bdai avatar Jan 14 '25 16:01 bhung-bdai

As a follow up: I have reason to believe this was a race condition. If the element removal is asynchronous, there might have been a case where I was removing the mesh and then removing it again before it was properly deleted. This may also be fixed in later versions, which I haven't been able to test. As a result I don't think this is that much of an issue.

bhung-bdai avatar Jan 14 '25 19:01 bhung-bdai

Okay, thanks for the update!

I haven't seen this particular issue, but if you're able to make a reproducible example I could debug it. Perhaps this is hard if it's a race condition problem, though.

As an additional note the newer versions of viser will take async callback functions that are run in viser's main event loop (by default they are run from a thread pool). This might help with race conditions.

brentyi avatar Jan 14 '25 20:01 brentyi