Bad_alloc error in import open3d

Since r30305, we are getting this error after pip_install(“open3d==0.10.0”). This is on ubuntu 20.04.

I believe Bad allocation is an out of memory error, so I assume real error is something else. Any suggestions on how to debug this will be great

import open3d
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/docker/MyData/Slicer-4.13.0-2021-10-14-linux-amd64/lib/Python/lib/python3.6/site-packages/open3d/__init__.py", line 47, in <module>
    from open3d.open3d_pybind import camera
ImportError: std::bad_alloc

@agporto @smrolfe

I’d suggest testing to see if the same thing happens in a non-slicer python. Also if you can build a open3d from source in debug mode you could single-step through and see what operation leads to the exception. Or on linux you can use strace to see what system calls happen before the exception.

Can confirm that no such error is triggered on the system python when importing open3d. Although that’s version 3.8.10

Anymore suggestions on this?
This error breaks the functionality of ALPACA on linux platforms.

recvmsg(8, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(8, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\34\0\337\0005\5\0\0\373\0\0\0\26\313\37\32\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 32
recvmsg(8, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(8, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
select(21, [4 8 9 20], [], [], {tv_sec=21, tv_usec=917487}Python console user input: import open3d
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/maga/Downloads/Slicer/lib/Python/lib/python3.6/site-packages/open3d/__init__.py", line 47, in <module>
    from open3d.open3d_pybind import camera
ImportError: std::bad_alloc
) = 1 (in [8], left {tv_sec=6, tv_usec=651769})
recvmsg(8, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\34\0\337\0005\5\0\09\1\0\0\270\6 \32\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 64
recvmsg(8, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(8, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)

When you use an older Slicer preview version, it begins to work again? Fresh install of that older version.

I just tried with a fresh install of r30222 and pip_install and import open3d worked fine.

What’s the date on these two revisions you’ve mentioned?

And does the same error happen if you pip install in Slicer a newer release of Open3D? A new version will force a new download assuming you haven’t done it before and not use any cached wheel.

Yes. It does happen with new install.

We have the problem since r30305. I am not sure how to go back to dates.

When you use the version that is r30305, does it not show the date next to the Slicer version in a window title bar or in Help->About Slicer?

Sorry, I don’t have the r30305 installed anymore (too many transient versions of slicer confuses my workflows. I download, try and remove it). r30222 (working one) is from 9/18.

slicer.app.repositoryRevision should get the same type of information that I want. Just wanting to know the commit hashes so I can compare things that happened between working and not working.

Try the following 2 builds on Linux and see if it works on one or other. If it fails on both I can provide you with another set to test.

Aren’t these prior to r30305? Those should work.

You tested every version earlier than r30305 to know that it was exactly this version where it broke?

r30297 works as well.
And yes I believe @agporto tested all versions up to r30305, but wasn’t able to find a specific change that might explain the crash.

Ok, r30305 (Sicer 4.13.0-2021-10-07) CDash - View Files, was the first release from the Slicer Linux Factory build machine that used GCC7 instead of GCC5. It was turned on first for this release as a test (metroplex: Temporarily use gcc7 image for nightly · Slicer/DashboardScripts@c92c280 · GitHub) and then was turned on permanently for all subsequent days. This switch from GCC7 from GCC5 was to fix a long running issue with SlicerJupyter not building correctly on Linux (Linux: extension SlicerJupyter not available in 4.13 preview releases · Issue #59 · Slicer/SlicerJupyter · GitHub). Looking at the commits from October 7th and 6th on the Slicer there isn’t something obvious.

I am building a py wheel for open3d, and will try to install that. But I am not sure how to do that with the slicer’s pip_install. Can I point out to a file?