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

SIGSEGV when creating simppl::dbus::Skeleton from thread #25

Open
tverdonck opened this issue Jan 26, 2023 · 1 comment
Open

SIGSEGV when creating simppl::dbus::Skeleton from thread #25

tverdonck opened this issue Jan 26, 2023 · 1 comment

Comments

@tverdonck
Copy link

Hi,

I'm currently having an issue when creating simppl::dbus::Skeleton instances from a thread.

A thread different then the dispatcher thread.

This results in SIGSEGV.

I've written a unittest to show the use case.

#include <gtest/gtest.h>

#include "simppl/skeleton.h"
#include "simppl/dispatcher.h"
#include "simppl/interface.h"

#include <thread>

constexpr const char* bus = "bus:session";
constexpr const char* name = "com.dummy";
constexpr const char* path = "/com/dummy/";

INTERFACE(Dummy)
{
  Property<int> Test;
  Dummy() :
     INIT(Test)
  {
  }
};

int index_ = 0;

class DummyService : public simppl::dbus::Skeleton<Dummy>
{
public:
  DummyService(simppl::dbus::Dispatcher& d) : simppl::dbus::Skeleton<Dummy>(d, name, "/dummy/" + std::to_string(index_++))
  {
  }
};


using namespace std::chrono_literals;
TEST(Crash, crash)
{
  simppl::dbus::Dispatcher d(bus);
  
  DummyService service1(d);
  DummyService service2(d);
  
  std::thread thread1 = std::thread([&d] {
    std::this_thread::sleep_for(2000ms);
    DummyService service3(d);
  });
  
  d.run();
}
@martinhaefner
Copy link
Owner

simppl is by default not intended to serve services in multiple threads. Sorry.

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

2 participants