Fast-DDS icon indicating copy to clipboard operation
Fast-DDS copied to clipboard

Domain::createSubscriber fails if executed on another thread [5625]

Open codewithpassion opened this issue 7 years ago • 4 comments

Hi there,

I'm getting an exception trying to call Domain::createSubscriber.

In our system we use a discovery message sent on a wildcard partition. The discovery message contains a string with a specific partition name. Upon receiving the discovery message, I want to create a new subscriber, subscribing to another message with the given partition.

Now, when I receive the discovery message, and I then try to create a new subscriber inside the discovery receiving thread, the thread exits without an exception at all.

Is this expected behaviour? Do I have to create all the subscribers inside the main application thread?

If I bypass the discovery and create my specific subscriber inside the main app thread it works as expected.

Regards, Dominik

codewithpassion avatar Jun 10 '19 13:06 codewithpassion

Hi @codewithpassion

Let's see if I understand what you mean. So you are trying to create another subscriber in the first subscriber's listener function. Or are you creating it in a new thread in there? And then, what's happening? Are you getting an exception or the thread exits well?

I've tried to make an example code and what I got is a deadlock, because the first subscriber stops listening because it's waiting for the new subscriber.

Can you post some code so I can understand better what you want to do?

AlvaroMolinillo avatar Jun 18 '19 06:06 AlvaroMolinillo

Hi @AlvaroMolinillo thanks for your response.

Yes, I'm trying to create a new Subscriber inside the first subscribers listener function. I've got this in a bigger piece of code that I cannot post like that but I'll recreate it and post it. As I'm travelling at the moment, this will take me a few days.

Thanks Dom

codewithpassion avatar Jun 22 '19 03:06 codewithpassion

Hi @codewithpassion Any advancement with your issue? If you can provide us the example code we will review it, but as @AlvaroGonzalezMolinillo said, a deadlock is expected.

LuisGP avatar Sep 09 '19 14:09 LuisGP

Closing this, as the question was answered. Feel free to reopen if still an issue.

MiguelCompany avatar Jan 09 '20 11:01 MiguelCompany