Code Monkey home page Code Monkey logo

Comments (10)

themarpe avatar themarpe commented on August 30, 2024

@Wallbraker thanks for the report.
Does this issue happen when the application exits or even before reading the first message?
By the looks of it, the message reading part looks okay, only freeing the data after it was copied into the message.

In this case however, it seems that XLink gets a disconnect request, which causes the freeing of the incoming data. (See freed by thread T49 here:)

How do you manage the returned Device object? It encapsulates the connection to the device and must be kept alive for the duration of the communication between the host & device.

from depthai-core.

Wallbraker avatar Wallbraker commented on August 30, 2024

@themarpe Thank you for your reply.

I looked into it and while we use a thread to get the images, we stop the thread before deleting the device.

I added a explicit call close on the queue just before deleting the device the problem goes away. I would like to point out that none of your examples calls close on the queue so I do not expect this to be required.

from depthai-core.

themarpe avatar themarpe commented on August 30, 2024

@Wallbraker sorry for going around here - I think that this actually relates to some use case "bug" which was fixed in latest develop.
Can you retest without an explicit close on latest develop branch? (We'll be releasing 2.11.0 soon as well)

from depthai-core.

diablodale avatar diablodale commented on August 30, 2024

hello. I've isolated scenarios where definitely parseMessageToADatatype() and possibly parseMessage() are given a non-null streamPacketDesc_t* packet But.....the struct it points to is {null, 0}
This causes readIntLE() to return nonsense values (in my case it always returns 171) which then incorrectly passes the "bad packet" test and then proceeds to index into unallocated memory and other things like try to initialize a std::vector from a nullptr.

The fix is to validate parameters. At the top of both those parsexxxx functions, put

if (!packet->data || !packet->length) {
    throw std::runtime_error("Bad packet, couldn't parse");
}

This I've isolated and reproduced in MSVC. And looking at the stack in the OP it matches there also.

from depthai-core.

diablodale avatar diablodale commented on August 30, 2024

@Wallbraker there are bugs in depthai regarding threads and ownership. I've found the bugs with Connection and you are right to question Device. #257

from depthai-core.

Wallbraker avatar Wallbraker commented on August 30, 2024

@themarpe I have so far not gotten this error v2.13.3 after removing the explicit queue->close(); call. Will do some more experiments and see I can catch it, and close this issue if not.

from depthai-core.

Wallbraker avatar Wallbraker commented on August 30, 2024

Spoke to soon, just got one. Basically the same backtraces.

from depthai-core.

Wallbraker avatar Wallbraker commented on August 30, 2024

I'm running the camera at 118 FPS, if that might help you trigger it.

from depthai-core.

diablodale avatar diablodale commented on August 30, 2024

I've already found the cause of this. It is issue #257

The fail asan lists in the OP

#11 0x7fbc566b3f5f in dai::StreamMessageParser::parseMessageToADatatype

is a direct result of the bugs of the issue #257. There is no fix other than to resolve that.
You can workaround the problems using the branch I list in the issue. But it will only work on Windows because Linux doesn't have a way to catch SEGFAULTs while also maintaining C++ stack unwinds.

from depthai-core.

Wallbraker avatar Wallbraker commented on August 30, 2024

Ah thank you for the information, I'm currently working around it by closing the queue.

from depthai-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.