facebookresearch / pytorch3d

PyTorch3D is FAIR's library of reusable components for deep learning with 3D data
https://pytorch3d.org/
Other
8.81k stars 1.32k forks source link

test_opengl_utils.py doesn't appear to release lock. #1908

Closed VRehnberg closed 1 week ago

VRehnberg commented 2 weeks ago

🐛 Bugs / Unexpected behaviors

Running pytest tests/test_opengl_utils.py test/test_rasterizer.py will hang on test_rasterizer.py. Neither hangs when running them as separate processes, but test/test_rasterizer.py is not unique in hanging (egl context seem to be the common denominator).

Modifying https://github.com/facebookresearch/pytorch3d/blob/main/pytorch3d/renderer/opengl/opengl_utils.py#L187 to use threading.RLock instead yields errors instead of hanging (you might also want to replace https://github.com/facebookresearch/pytorch3d/blob/main/pytorch3d/renderer/opengl/opengl_utils.py#L227-L235 with a with self.lock: context for simplicity).

Doesn't seem to be a critical issue but, hard to tell as you'd expect tests to not fail (there was a smattering of other failures as well, might report them separately).

bottler commented 2 weeks ago

I knew that some sort of problem like this was around. Thank you very much for the report.

The OpenGL renderer is a bit stuck at the moment: internally the dependencies are not working and it is not in use. Its tests are not working.

bottler commented 1 week ago

The attached commit makes both changes.