Skip to content

Mat.addref() sometimes freezes #12

@sfe-SparkFro

Description

@sfe-SparkFro

While testing, I've run into occasional situations where the RP2350 freezes after running some OpenCV function. I eventually poked around with a debugger, and it turns out that calling Math.addref() can sometimes freeze for an unknown reason.

Math.addref() calls CV_XADD(&u->refcount, 1), which in turn calls the platform's atomic add function (CV_XADD macro magic here). I'm not sure what that actually is for the RP2350, nor why it would cause a freeze.

There are underlying OpenCV calls to both Math.addref() and CV_XADD(&u->refcount, 1), so can't necessarily do anything here. But might be able to define a special CV_XADD that just increments without an atomic operation. Should be safe because of the Python GIL, right?

Will follow up with replication code if I can find something that easily replicates the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions