System failure when using seteuid() after connecting to Hailo

I have a process that needs to start as root. Once I’ve performed the privileged operations, I drop privileges by using seteuid() + seteguid(). When I do this, I get a string of Hailo errors, and the program exits.

To be clear, when I initially connect to the Hailo accelerator, I am running as root. A few seconds later, I change my effective user id.

I’m just looking for clarity on why this happens, so that I can understand how I should architect my privilege escalation/drop code.

Here is the log:

[HailoRT] [error] CHECK failed - poll failed with errno=4
[HailoRT] [error] CHECK failed - poll failed with errno=4
[HailoRT] [error] CHECK failed - poll failed with errno=4
[HailoRT] [error] CHECK failed - poll failed with errno=4
[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_INTERNAL_FAILURE(8)
[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_INTERNAL_FAILURE(8)
[HailoRT] [warning] m_items_enqueued_sema received an unexpected failure
[HailoRT] [warning] m_items_enqueued_sema received an unexpected failure
[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_INTERNAL_FAILURE(8)
[HailoRT] [warning] m_items_enqueued_sema received an unexpected failure
[HailoRT] [error] Non-recoverable Async Infer Pipeline error. status error code: HAILO_INTERNAL_FAILURE(8)
[HailoRT] [error] Shutting down the pipeline with status HAILO_INTERNAL_FAILURE(8)
[HailoRT] [error] Non-recoverable Async Infer Pipeline error. status error code: HAILO_INTERNAL_FAILURE(8)
[HailoRT] [error] Non-recoverable Async Infer Pipeline error. status error code: HAILO_INTERNAL_FAILURE(8)
[HailoRT] [error] Shutting down the pipeline with status HAILO_INTERNAL_FAILURE(8)
[HailoRT] [error] Shutting down the pipeline with status HAILO_INTERNAL_FAILURE(8)
terminate called after throwing an instance of 'std::system_error'
  what():  Resource deadlock avoided
2024-09-11 11:18:06.105967 Error kernelwg conn.Read failed: EOF
2024-09-11 11:18:06.106050 Info kernelwg Exiting