-
Notifications
You must be signed in to change notification settings - Fork 388
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
application can't create publisher repeatedly with previous one already destroyed #938
Comments
@qclzdh currently we do not communicate the destruction of a port to RouDi to release the resources. The cleanup is done when the application stops and unregisters at RouDi or when an application crashes and RouDi does the cleanup. Up until now we did not have such a use case like you described because the publisher always lived as long as the application. What is the use case for the scenario you described? |
@qclzdh forget what I wrote about the release of the resource. It is released, but with a delay. In order to not block the destructor of the publisher only a flag is set and in the so called RouDi discovery loop the port is reclaimed by RouDi. So when you wait some time before the publisher is recreated it works. iox::capro::ServiceDescription serviceDescription{"Radar-test", "FrontLeft-test", "Object"};
auto p_publisher = std::make_shared<iox::popo::Publisher<RadarObject>>(serviceDescription);
p_publisher->stopOffer();
p_publisher.reset();
std::this_thread::sleep_for(std::chrono::milliseconds(2 * iox::roudi::DISCOVERY_INTERVAL.toMilliseconds()));
p_publisher = std::make_shared<iox::popo::Publisher<RadarObject>>(serviceDescription); We could optimize this at the cost of slightly increasing the latency of creating new ports by checking the destruction flag for all the existing publisher ports and let RouDi reclaim a port which is marked for destruction before a new one is created @budrus @elfenpiff @MatthiasKillat what do you think? |
@elBoberido I completely agree. As a developer I would expect that the publisher is fully destroyed and all the resources are released when it is out of scope or the destructor should block the process until this is ensured. |
@elfenpiff right. With reclaim I mean exactly what you wrote |
@elfenpiff @elBoberido This is a consequence of the delayed destruction in the discovery loop. I forgot the reasons why we did it like this and do not block the d'tor and wait for RouDi to acknowledge the removal of the old port. Maybe to avoid the races with the discovery loop? I think we should fix this for the 2.0 release. Either like you propose by having a discovery (light) when creating a new port or by refactoring the cleanup |
…ication policy violation
…ication policy violation
…ication policy violation
…truction-in-does-violate-communication-policy iox-#938 check for publisher destruction in does violate communication policy
@qclzdh FYI, will be fixed with the upcoming 2.0 release |
Thanks~ |
Required information
Operating system:
Ubuntu 20.04 LTS
Compiler version:
GCC 9.3.0
Observed result or behaviour:
test application reported some error log:
[ Error ]: Request publisher received no valid publisher port from RouDi
[Warning]: Service '10:Radar-test14:FrontLeft-test6:Object1:01:01:01:01:01:0' already in use by another process.
[Warning]: ICEORYX error! POSH__RUNTIME_PUBLISHER_PORT_NOT_UNIQUE
Roudi log:
2021-10-08 15:27:33.443 [ Debug ]: Registered new application iox-cpp-publisher-helloworld
2021-10-08 15:27:33.444 [ Debug ]: Created new ApplicationPort for application iox-cpp-publisher-helloworld
2021-10-08 15:27:33.445 [ Debug ]: Created new PublisherPort for application iox-cpp-publisher-helloworld
2021-10-08 15:27:33.446 [ Debug ]: Created new PublisherPort for application iox-cpp-publisher-helloworld
2021-10-08 15:27:33.446 [Warning]: Process 'iox-cpp-publisher-helloworld' violates the communication policy by requesting a PublisherPort which is already used by 'iox-cpp-publisher-helloworld' with service '10:Radar-test14:FrontLeft-test6:Object1:01:01:01:01:01:0'.
2021-10-08 15:27:33.446 [Warning]: ICEORYX error! POSH__PORT_MANAGER_PUBLISHERPORT_NOT_UNIQUE
2021-10-08 15:27:33.446 [ Error ]: Could not create PublisherPort for application iox-cpp-publisher-helloworld
2021-10-08 15:27:33.541 [ Debug ]: Destroyed publisher port
Expected result or behaviour:
I expect the same publisher should be created successfully while previous one already destroyed.
Conditions where it occurred / Performed steps:
iox::capro::ServiceDescription serviceDescription{"Radar-test", "FrontLeft-test", "Object"}; std::shared_ptr<iox::popo::Publisher<RadarObject>> p_publisher = std::make_shared<iox::popo::Publisher<RadarObject>>(serviceDescription); p_publisher->stopOffer(); p_publisher.reset(); p_publisher = std::make_shared<iox::popo::Publisher<RadarObject>>(serviceDescription);
The text was updated successfully, but these errors were encountered: