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

broken pub/sub connection by dynamic recreation of a publisher or subscriber #1218

Closed
rex-schilasky opened this issue Oct 17, 2023 · 0 comments · Fixed by #1222
Closed

broken pub/sub connection by dynamic recreation of a publisher or subscriber #1218

rex-schilasky opened this issue Oct 17, 2023 · 0 comments · Fixed by #1222
Assignees
Labels
bug Something isn't working

Comments

@rex-schilasky
Copy link
Contributor

rex-schilasky commented Oct 17, 2023

Problem Description

After introduction of the new fast unregistration mode (#1086) shm synchronization events between datawriter (sending process) and memfile observer (receiving process) are destroyed (shm_unlink) either by a stopped publisher or subscriber even the event is still used by "the other side" (either the shm data writer or the memfile observer).

This leads to a broken connection if a new publisher/subscriber is created dynamically using the same topic name again.

How to reproduce

  1. Start ecal_sample_person_snd
  2. Start this adapted ecal_sampl_person_rec variant
int main(int argc, char **argv)
{
  // initialize eCAL API
  eCAL::Initialize(argc, argv, "person subscriber");

  std::cout << std::endl << "FIRST RUN" << std::endl << std::endl; eCAL::Process::SleepMS(1000);
  {
    eCAL::protobuf::CSubscriber<pb::People::Person> sub("person");
    sub.AddReceiveCallback([](const char* /*topic_*/, const pb::People::Person& person_, long long /*time_*/, long long /*clock_*/, long long /*id_*/){std::cout << "person id : " << person_.id() << std::endl;});
    eCAL::Process::SleepMS(3000);
  }

  std::cout << std::endl << "SECOND RUN" << std::endl << std::endl; eCAL::Process::SleepMS(1000);
  {
    eCAL::protobuf::CSubscriber<pb::People::Person> sub("person");
    sub.AddReceiveCallback([](const char* /*topic_*/, const pb::People::Person& person_, long long /*time_*/, long long /*clock_*/, long long /*id_*/){std::cout << "person id : " << person_.id() << std::endl;});
    eCAL::Process::SleepMS(3000);
  }

  // finalize eCAL API
  eCAL::Finalize();

  return(0);
}
  1. In the ´SECOND RUN´ the subscriber will not receive any data.

How did you get eCAL?

I don't know

Environment

  • eCAL: 5.12
  • OS: Ubuntu 20.04

eCAL System Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant