Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding simple data to a CAS / SceneCAS::get() crashes #87

Open
Sanic opened this issue Apr 28, 2017 · 3 comments
Open

Adding simple data to a CAS / SceneCAS::get() crashes #87

Sanic opened this issue Apr 28, 2017 · 3 comments

Comments

@Sanic
Copy link
Contributor

Sanic commented Apr 28, 2017

As discussed with @bbferka, how can i add a simple test string to the CAS do use it across different Annotators?

rs::SceneCas scas(tcas);
rs::Annotation someAnnotation = rs::create<rs::Annotation>(tcas);
std::string someStr("mytest");
someAnnotation.source.set(someStr);
someAnnotation.source.get(); // <- This call works
scas.set("example", someAnnotation);

// Read back for verification
rs::Annotation testAnno = rs::create<rs::Annotation>(tcas);
scas.get("example", testAnno);
testAnno.source.get(); // <- This call crashes

This is the error message:

Program received signal SIGSEGV, Segmentation fault.
uima::FeatureStructure::isValid (
    this=0x7ffff7b16db4 <uima::FeatureStructure::getStringValue(uima::Feature const&) const+20>, 
    this@entry=0x7fffffffc5f0) at ../cas/featurestructure.cpp:237
237        return iv_tyFS != 0 && ( iv_cas->getHeap()->isValid(iv_tyFS));

As @bbferka pointed out, a quick fix for this seems to be to use getFS() instead of get() in the second code block. But why is get() crashing?

@jworch
Copy link
Collaborator

jworch commented Apr 28, 2017

I remember having a similar problem when adding rs::human (which is of type identifiable)

cas.set(VIEW_HUMAN, *m_skeleton);
// If access to rs::Human is needed use this instead of the struct:
//    uima::FeatureStructure fs;
//    if(!cas.getFS(VIEW_HUMAN, fs))
//    {
//      outInfo("No Humans detected. Nothing to broadcast.");
//      return;
//    }
//    rs::Human human2(fs);
//    std::vector<rs::Joint2D> joints2d = human2.joints2D();
//    std::vector<rs::Joint3D> joints3d = human2.joints3D();
//    outInfo(joints2d.at(0).position().x());
//    outInfo(joints3d.at(0).position().x());

//... otherwise access the struct this way:
//        struct skeletonHuman human2;
//        if(!cas.get(VIEW_HUMAN, human2))
//        {
//          outInfo("No Humans detected. Nothing to broadcast.");
//          return;
//        }
//        outInfo(human2.joint2D[0].x);
//        outInfo(human2.joint3D[0].x);

Back then we tried to identify the problem, but (due to being short in time) we stopped investigating this any further.

Might be worth having a look at it again.

@jworch
Copy link
Collaborator

jworch commented Apr 28, 2017

We just did some experiments. Have a look at: 730736e

For some strange reason it works....

@bbferka
Copy link
Collaborator

bbferka commented May 1, 2017

Using 730736e does not fix it for me. Using getFS solves this issue for now. I'll leave the issue open and hopefully we'll have the time to look at this in more detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants