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

DataWriter write data crash frequently with segment fault when using ContentFilteredTopic #4878

Open
1 task done
GalaxyDreamWings opened this issue May 30, 2024 · 3 comments
Labels
need more info Issue that requires more info from contributor

Comments

@GalaxyDreamWings
Copy link

Is there an already existing issue for this?

  • I have searched the existing issues

Expected behavior

use ContentFilteredTopic and set filter expression to receive required data

Current behavior

The operation seem to be valid and the application can run normally for a while but would crash occasionally or even frequently with segment fault. But if DataReader doesn't use ContentFilteredTopic, everything is well.
The call stack is shown below:

libfastrtps. so. 2.14!
void eprosima::fastdds::dds::ContentFilterInfo::cdr_serialize
<eprosima: :fastdds: :dds: :ReaderFilterCollection: :update_filter_info
(eprosima: :fastdds : :dds : :DataWriterFilteredChange&,
eprosima::fastrtps: :rtps: :SampleIdentity const&) const:: {lambda (unsigned long,unsigned char*)#1}>(eprosima: :fastrtps: :rtps: :SerializedPayload_t&, unsigned long, eprosima: :fastdds : : dds : :ReaderFilterCollection::update_filter_info (eprosima: :fastdds : :dds : :DataWriterFilteredChange&,
eprosima::fastrtps::rtps: :SampleIdentity const&) const:: {lambda(unsigned long,unsigned char*)#1}) (Unknown Source:0)
libfastrtps. so. 2.14!
eprosima::fastdds : : dds : :DataWriterImpl : :perforn_create_new_change
(eprosima: :fastrtps::rtps::ChangeKind_t, void*,
eprosima::fastrtps: :rtps : :WriteParams&,
eprosima: :fastrtps: :rtps : : InstanceHandle_t const&) (Unknown Source:0)*
libfastrtps.so. 2.14!
eprosima::fastdds: :dds: :DataWriterImpl: :create_new_change_with_params
(eprosima: :fastrtps: :rtps::ChangeKind_t, void*, eprosima::fastrtps::rtps::WriteParams&) (Unknown Source:0)
libfastrtps. so. 2. 14!
eprosima: :fastdds : :dds : :DataWriterImpl : :create_new_change (eprosima::fastrtps: :rtps::ChangeKind_t, void*) (Unknown Source:0)*
libfastrtps. so. 2. 14!
eprosima: :fastdds: :dds : :DataWriterImpl: :write(void*)(Unknown Source:0)

Steps to reproduce

The IDL file:

struct DMsg
{
    unsigned long actorId;
    sequence<char> msgContent;
};

And the filter expression:

string expression = "actorId = 0x12345678";
vector<string> parameters;
setTopicFilter(ESMsgId::eServerState,expression,parameters);

void CFastDDSManager::setTopicFilter(ESMsgId smsgId, std::string expression, std::vector<std::string> parameters)
{
    auto iter_map_topic = m_map_topic.find(smsgId);
    if (iter_map_topic != m_map_topic.end()) {
        if(iter_map_topic->second.pFilteredTopic == nullptr) {
            ContentFilteredTopic* pFilteredTopic = m_pParticipant->create_contentfilteredtopic(
                    iter_map_topic->second.pTopic->get_name() + "_Filtered", iter_map_topic->second.pTopic, expression,
                    parameters);

            iter_map_topic->second.pFilteredTopic = pFilteredTopic;
        }else {
            iter_map_topic->second.pFilteredTopic->set_filter_expression(expression,parameters);
        }
    }
}

relevant code for write data:

if(msg.getLength() != 0) {
        std::vector<char> vec_msgContent(msg.getContent(),msg.getContent() + msg.getLength());
        DMsg dmsg;
        dmsg.msgContent(vec_msgContent);
        dmsg.actorId(0x12345678);
        return iter_map_topic->second.writer->write(&dmsg);
}

Fast DDS version/commit

2.14.x

commit 74b2a74 (HEAD -> master, origin/master, origin/HEAD, origin/2.14.x)
Author: Des glaneurs [email protected]
Date: Tue Mar 12 17:34:01 2024 +0900

Platform/Architecture

Ubuntu Focal 20.04 arm64, Other. Please specify in Additional context section.

Transport layer

Default configuration, UDPv4 & SHM

Additional context

Galaxy Kylin OS (Linux) aarch64 run in docker

XML configuration file

No response

Relevant log output

No response

Network traffic capture

No response

@GalaxyDreamWings GalaxyDreamWings added the triage Issue pending classification label May 30, 2024
@elianalf
Copy link
Contributor

elianalf commented Jun 3, 2024

Hi @GalaxyDreamWings,
thanks for using Fast DDS.

We will have a look and try to reproduce the issue. We will come back with a feedback.

@elianalf elianalf added in progress Issue or PR which is being reviewed and removed triage Issue pending classification labels Jun 3, 2024
@Mario-DL
Copy link
Member

Hi @GalaxyDreamWings
I have been testing with the following diff using a modified version of the ContentFilterTopicExample with the information you provided but I could not reproduce the issue. With that patch applied I tried DDSContentFilteredTopicExample --publisher in one terminal and DDSContentFilteredTopicExample --subscriber in another, then killing and relaunching the publisher several times, but no crash occurred.

I'm afraid that we would need more information about the application or a reproducer from your side, would it be possible ?

@Mario-DL Mario-DL added need more info Issue that requires more info from contributor and removed in progress Issue or PR which is being reviewed labels Jun 11, 2024
@GalaxyDreamWings
Copy link
Author

Hi!@Mario-DL
Thanks for your reply! But I'm sorry that I can't put my code here for some reason. I run my application in docker container on aarch64 server, so have you tried it? And It is confusing that it won't always crash, instead, it will run normally for a while , and crash occasionally. Also, the coredump trace always stop at eprosima::fastdds::dds::ContentFilterInfo::cdr_serialize function, but the data to be written seems normal. So can you find some clues for the problem with the coredump info that I provided? I can't solve it so I have to turn to try PartitionQos to achieve filter functionality. Hopes for your reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need more info Issue that requires more info from contributor
Projects
None yet
Development

No branches or pull requests

3 participants