-
Notifications
You must be signed in to change notification settings - Fork 912
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
rospy: get_num_connections() does not return 0 when a topic is unsubscribed #526
Comments
and by the way, @lsouchet tried in C++ with getNumSubscribers and that works there |
Does it work as expected if queue_size=None (the old blocking-publisher code). If so, then this is likely a regression in the new non-blocking code -- not sure how that code eventually determines a connection is lost though. |
I just tried with queue_size=None and it works indeed.
By roughly ebugging the code, it appears that the connection passed to the remove_connection() method is not the same as the one stored in the publisher connection list.
While the connection list contains:
I hope it can help. |
The problem is that the connection is not removed on the publisher side because of the following check to fail when using the QueuedConnection: ros_comm/clients/rospy/src/rospy/topics.py Line 354 in 52e3921
This is a regression of #308. Any fix will need to be backported to Hydro. |
Please try the patch from #531 and confirm that it fixes the problem for you, too. |
+1, works for me with the given example of @lsouchet |
I confirm, this seems to fix my issue! |
* upstream/indigo-devel: fix regression of PR ros#515 Adding support for fixed-width floating-point and integer array values as per issue ros#400 Fix exception at roslaunch startup if python is build without ipv6 support. Fix exception at roscore startup if python has ipv6 disabled. use fileno comparison only as an alternative and when available fix removal of QueuedConnection leading to wrong subscriber count (fix ros#526) fix comment (fix ros#529) unregister statistics publisher Fix: TCPROS header validation crash when `callerid` header is not set avoid storing subscriber reference in SubscriberStatisticsLogger only create SubscriberStatisticsLogger when enabled make param functions thread-safe Do not use Python when building for Android Do not use ifaddrs on Android as it is not natively supported
* upstream/indigo-devel: fix regression of PR ros#515 Adding support for fixed-width floating-point and integer array values as per issue ros#400 Fix exception at roslaunch startup if python is build without ipv6 support. Fix exception at roscore startup if python has ipv6 disabled. use fileno comparison only as an alternative and when available fix removal of QueuedConnection leading to wrong subscriber count (fix ros#526) fix comment (fix ros#529) unregister statistics publisher Fix: TCPROS header validation crash when `callerid` header is not set avoid storing subscriber reference in SubscriberStatisticsLogger only create SubscriberStatisticsLogger when enabled make param functions thread-safe Do not use Python when building for Android Do not use ifaddrs on Android as it is not natively supported
Hi, I have experienced the same issue on melodic, was the fix not propagated? |
Tested on latest indigo.
When I run a test node that displays the number of subscribers for my node using get_num_connections(), I see that this method returns 0 on startup, raise to 1 when I start a rostopic echo, and does not go back to 0 when the listener is killed.
The cpp equivalent using getNumSubscribers() works fine.
To reproduce:
Here is the node code.
rostopic echo /chatter
=> The publisher console outputs "subscribers: 1"
Kill the rostopic echo
=> The publisher console outputs "subscribers: 1"
I was hoping to manage the node activity according to the number of subscribers to that node.
The text was updated successfully, but these errors were encountered: