depthai-python icon indicating copy to clipboard operation
depthai-python copied to clipboard

Segmentation fault

Open f-alemauro opened this issue 2 years ago • 8 comments

Hi!

Some days ago a service of ours using depthai-python library crashed. This is the log I have found about this crash:

Jun 22 18:08:41 easycounter kernel: [65303.616870] usb 1-1.2: new high-speed USB device number 10 using xhci_hcd
Jun 22 18:08:41 easycounter kernel: [65303.747699] usb 1-1.2: New USB device found, idVendor=03e7, idProduct=2485, bcdDevice= 0.01
Jun 22 18:08:41 easycounter kernel: [65303.747720] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jun 22 18:08:41 easycounter kernel: [65303.747736] usb 1-1.2: Product: Movidius MyriadX
Jun 22 18:08:41 easycounter kernel: [65303.747752] usb 1-1.2: Manufacturer: Movidius Ltd.
Jun 22 18:08:41 easycounter kernel: [65303.747767] usb 1-1.2: SerialNumber: 03e72485
Jun 22 18:08:41 easycounter mtp-probe: checking bus 1, device 10: "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2"
Jun 22 18:08:41 easycounter mtp-probe: bus: 1, device: 10 was not an MTP device
Jun 22 18:08:41 easycounter mtp-probe: checking bus 1, device 10: "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2"
Jun 22 18:08:41 easycounter mtp-probe: bus: 1, device: 10 was not an MTP device
Jun 22 18:08:42 easycounter python3[1162]: Stack trace (most recent call last) in thread 14680:
Jun 22 18:08:42 easycounter python3[1162]: #3    Object "/home/brsadm/bs4-ai-core/venv/lib/python3.7/site-packages/depthai.libs/libstdc++-8790593d.so.6.0.25", at 0xb55049af, in
Jun 22 18:08:42 easycounter python3[1162]: #2    Object "/home/brsadm/bs4-ai-core/venv/lib/python3.7/site-packages/depthai.cpython-37m-arm-linux-gnueabihf.so", at 0xb594d603, in
Jun 22 18:08:42 easycounter python3[1162]: #1    Object "/lib/arm-linux-gnueabihf/libc.so.6", at 0xb6cee11f, in
Jun 22 18:08:42 easycounter python3[1162]: #0    Object "/home/brsadm/bs4-ai-core/venv/lib/python3.7/site-packages/depthai.cpython-37m-arm-linux-gnueabihf.so", at 0xb5a0d3b3, in backward::SignalHandling::sig_handler(int, siginfo_t*, void*)
Jun 22 18:08:42 easycounter python3[1162]: Segmentation fault (Address not mapped to object [0x4])
Jun 22 18:08:42 easycounter kernel: [65304.087224] usb 2-2: USB disconnect, device number 8
Jun 22 18:08:42 easycounter kernel: [65304.087654] xhci_hcd 0000:01:00.0: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.

The stack trace seems to boils down to this library

depthai.cpython-37m-arm-linux-gnueabihf.so

After this crash, the system restarted the service, but didn't start correctly. I've got this error

Jun 22 18:09:11 easycounter python3[4873]: RuntimeError: Failed to find device (-ma2480), error message: X_LINK_DEVICE_NOT_FOUND

when calling the function .getMxID()

This is the configuration

Raspberry PI 4 with POE Hat
Raspian buster
depthai v. 2.13.3.0
OAK-1 (on USB3)

f-alemauro avatar Jul 05 '22 10:07 f-alemauro

Thanks for the details here. And sorry about the trouble.

Do you have other USB devices powered off of the Pi? The background is the Pi can only provide something like 1.4A max across ALL of the ports. And OAK-1 can take about 1A. So if there are other devices being used on USB, the Pi can over-current on USB, which under-voltages the devices on USB.

Luxonis-Brandon avatar Jul 06 '22 01:07 Luxonis-Brandon

Well, I don't have any USB device, but OAK-1. I don't think the POE hat could cause power issues, do you? It is rated 5V/5A

BTW, thank you for the hint about raspberry max USB current

f-alemauro avatar Jul 06 '22 08:07 f-alemauro

Hi @f-alemauro , Could you also try a solution described here?

Erol444 avatar Jul 06 '22 09:07 Erol444

Hi @f-alemauro , Could you also try a solution described here?

If I get it correctly, I should set the USB-C port to host mode and connect my oak-1 to that usb-c port, right? Which are the advantages, if any?

f-alemauro avatar Jul 06 '22 09:07 f-alemauro

I'm trying that, but I cannot get it working. This is the current setup

photo_2022-07-12_14-16-16

Am I doing something wrong?

f-alemauro avatar Jul 12 '22 12:07 f-alemauro

Oh! Some USB3 hosts don't properly handle USB2 to USB3 transition that we use to move from USB bootloader (USB2) to operation (USB3). That's on potential.

But then also on the USB hub. Is it being powered by the Pi only and not an external source? The Pi can only do 1.3A total out over USB and the OAK-1 takes about 0.9A to 1A. So with the hub on there the Pi might be running out of power to the USB ports.

Luxonis-Brandon avatar Jul 13 '22 03:07 Luxonis-Brandon

I may not have been clear, sorry. I was trying to follow this suggestion

Hi @f-alemauro , Could you also try a solution described here?

and so I issued those commands and then connected the OAK-1 to the RPI. I didn't have any USBC-USBC cable with me, nor an USBA-USBC adapter, so I used that USB hub. The RPI seems to detect the USB hub, but the OAK-1 is not detected.

So, I was asking If that setup is ok

f-alemauro avatar Jul 13 '22 09:07 f-alemauro

YEs. Some USB hubs don't handle the transition right. And also if the hub is powered by the pi, the pi probably can't provide enough power to power the hub and the OAK-1 at the same time.

Luxonis-Brandon avatar Jul 13 '22 19:07 Luxonis-Brandon