IntelRealSense / RealSenseID

Intel® RealSense™ ID SDK
https://intelrealsense.com/facial-authentication/
Apache License 2.0
98 stars 57 forks source link

SendBytes() hangs after some time of being called in a loop #79

Closed michalrudowicz closed 3 years ago

michalrudowicz commented 3 years ago

Hi,

During testing I have been calling ExtractFaceprintsForEnroll() and ExtractFaceprintsForAuthentication() continously for a few minutes. After a while my process hangs, and when breaking into it in gdb this is what I see on top of the backtrace:

2021-06-02_14-11

I am using the following commit of RealSenseID: cb7b786ed7d092197ffa7e473d39564c776751c9

Is there any sort of an overheat protection in the camera's firmware? If yes, how can I "cooperate" with it to avoid hangs?

After restarting the program camera can be used without plugging in/plugging out.

michalrudowicz commented 3 years ago

The problem doesn't seem to reproduce if a short sleep (~10s) is added between repetitions.

michalrudowicz commented 3 years ago

Some more logs of what's happening before the hang:

## end ExtractFaceprintsForEnroll
[2021-06-07 08:43:02.318] [debug] [NonSecureSession] Start session
[2021-06-07 08:43:02.319] [debug] [PacketSender] Sending packet 'o'
[2021-06-07 08:43:02.322] [debug] [PacketSender] Waiting packet..
[2021-06-07 08:43:02.341] [debug] [PacketSender] Received packet 'o' after 18 millis
[2021-06-07 08:43:02.341] [debug] [PacketSender] Sending packet 'T'
[2021-06-07 08:43:02.343] [debug] [PacketSender] Waiting packet..
[2021-06-07 08:43:05.492] [debug] [PacketSender] Received packet 'R' after 3149 millis
enroll: on_result: status: NoFaceDetected
[2021-06-07 08:43:05.492] [debug] [PacketSender] Waiting packet..
[2021-06-07 08:43:05.493] [debug] [PacketSender] Received packet 'Y' after 0 millis
## end ExtractFaceprintsForEnroll
## start ExtractFaceprintsForAuth
[2021-06-07 08:43:05.496] [debug] [NonSecureSession] Start session
[2021-06-07 08:43:05.497] [debug] [PacketSender] Sending packet 'o'
[2021-06-07 08:43:05.500] [debug] [PacketSender] Waiting packet..
[2021-06-07 08:43:05.517] [debug] [PacketSender] Received packet 'o' after 17 millis
[2021-06-07 08:43:05.518] [debug] [PacketSender] Sending packet 'X'
[2021-06-07 08:43:05.519] [debug] [PacketSender] Waiting packet..
[2021-06-07 08:43:05.992] [debug] [PacketSender] Received packet 'R' after 472 millis
authenticate: on_result: status: NoFaceDetected
[2021-06-07 08:43:05.992] [debug] [PacketSender] Waiting packet..
[2021-06-07 08:43:05.993] [debug] [PacketSender] Received packet 'Y' after 0 millis
## end ExtractFaceprintsForAuth
## start ExtractFaceprintsForEnroll
[2021-06-07 08:43:07.479] [debug] [NonSecureSession] Start session
[2021-06-07 08:43:07.479] [debug] [PacketSender] Sending packet 'o'
michalrudowicz commented 3 years ago

I am still testing it, but from my observations:

The main difference that I saw was that RPi4's Debian came with Linux kernel 5.10, while Coral's Mendel Linux had Linux kernel 4.14. I've compared what commits were added into the kernel that changed the cdc-acm kernel module (which is used for serial communication to perform actions on the RealSense camera) and I've found around 50. After reading the commit messages, rebuilding the kernel and restarting I've found out that I am not able to reproduce the issue after cherry picking the following commit into the kernel:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=93e1c8a638308980309e009cc40b5a57ef87caf1

Therefore I assume that this is not a bug in RealSenseID, and I think this issue may be closed.