Skip to content

[BUG] uORB framework hangs when error code 0 is returned by function #15787

@linguini1

Description

@linguini1

Description / Steps to reproduce the issue

When a driver-level implementation of the selftest function returns a 0 (OK) error code, the uORB framework hangs indefinitely.

Steps to reproduce:

  • Create a stub for the selftest function
  • Return a negated error code from the selftest function unconditionally
  • Call self-test through application layer using orb_ioctl(fd, SNIOC_SELFTEST, 0)
  • Observe failure with return of -1
  • Change lower half selftest to return 0
  • Observe application layer call hangs indefinitely

I observed this issue while writing a self-test function for the LSM6DSO32 IMU. When the selftest fails everything is fine, but when it passes the function hangs forever. I was able to confirm this by adding a log statement at the exit point and changing the return code to -EACCESS before the function returns. The log statement gets executed and the function does not hang. It does hang if I remove the error code change code and allow the function to return 0.

/* Other code above ...*/
early_ret:
  nxmutex_unlock(&dev->devlock);
  /* This gets printed and -1 shown by orb_ioctl when returning -EACCES */
  sninfo("Finished selftest");
  return -EACCES;
  /* Commenting out the above line and replacing with 'return 0' results in hang */

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

Linux 6.13.1-arch1-1 #1 SMP PREEMPT_DYNAMIC GNU/Linux

NuttX Version

master

Issue Architecture

[Arch: arm]

Issue Area

[Area: OS Components]

Host information

No response

Verification

  • I have verified before submitting the report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Arch: armIssues related to ARM (32-bit) architectureArea: OS ComponentsOS Components issuesOS: LinuxIssues related to Linux (building system, etc)Type: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions