-
Notifications
You must be signed in to change notification settings - Fork 913
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: make multi threaded publishing default in indigo (#169) #346
Comments
I am absolutely not sure about the default behavior in Indigo. We should discuss this before going ahead (@wjwwood fyi). In Hydro an optional keyword argument can be used to specify the queue size:
I don't think that it is a good idea to make the new default value I think we should not:
Imo the options are only:
|
@dirk-thomas Does roscpp have a default N then? Ideally rospy should mirror roscpp here (as it's also what people expect). I concur that we should not require an argument to be passed, and 0 also seems pretty bad. I do not think we should keep it as-is, because quite frankly, this deficiency in rospy has been causing trouble for years (most people have simply considered the higher level software to be flaky, but as soon as this deficiency is explained to them, things tend to be realized to have been rospy locking up trying to publish to a lost subscriber). |
@mikeferguson No, roscpp does not have a default N. The roscpp API requires the user to pass in an explicit queue size: e.g. https://github.com/ros/ros_comm/blob/hydro-devel/clients/roscpp/include/ros/node_handle.h#L236 https://github.com/ros/ros_comm/blob/hydro-devel/clients/roscpp/include/ros/advertise_options.h#L58 I think that is the "right" way to do it but for rospy we can't enforce that now since the API did not require it until now. So the question remains: do we change the default value for it (and to what value) or do we keep it as-is. |
We could leave the current default, but print a warning notifying people that they should explicitly pass the argument. So existing code will continue to work as it currently does, but will get a message like this:
Or something like that. And then in J-Turtle we can require that the def create_publisher(name, data_class, queue_size, **kwargs):
return rospy.Publisher(name, data_class, queue_size=queue_size, **kwargs) |
While I see the advantage of having the user specify the queue size I am not convinced that printing a warning for every existing Python publisher is a good idea and especially requiring everybody for J-Turtle to change their code. Realistically it has worked for most of the users until now since the common use case is local communication. We could also emphasize this in the documentation and tutorials and mention it in the migration guide for indigo but not change any code/API at all. Perhaps getting some more user feedback might be a good idea before making a decision. |
If you believe that there is not good default value and/or that changing the current default is not a good idea, then I think there should be a warning. We can have a mechanism for suppressing the warning for people running code which they do not control, and I am ok with never removing the behavior, even in J-Turtle or later. I do not believe putting it in the migration guide and the tutorials will be sufficient to get people to change existing code. It really comes down to two questions:
I would say it is important to get people to change the existing code to prevent users from running into hard to debug problems and that the only people who will notice the documentation changes will be people who run into the problem and new users, so I think a more visible warning is needed. |
I agree that we should get broader feedback on this before making a decision. |
Could you please describe a bit more how you imagine to implement "a mechanism for suppressing the warning for people running code which they do not control"? |
There are plenty of ways to suppress it globally, like an environment variable, global configuration, or via a python global setting in a pythonrc file. If we use the python warnings module then the user can setup a warning filter, or we can setup a warning filter based on some user configuration. I don't really see that as being as important as deciding what behavior we want. |
I did not mean to say selectively disable the warning, just everywhere or no where. But that way they can disable the warnings once they have fixed their code, but not the code they don't control the release of. |
I like the idea of having a warning in indigo if queue_size isn't supplied, and requiring the argument in indigo. Since this is a relatively small fix, it might even be possible to provide a simple script that finds/replaces these in a repo and works most of the time. Even if that isn't done, it's probably worth changing all rospy tutorials to include queue_size in example code. New users tend to copy/paste those examples, so they should reflect good practices: http://wiki.ros.org/rospy_tutorials/Tutorials/WritingPublisherSubscriber |
Oops, mean to say that I like the idea of a warning in indigo, and requiring the argument in j-turtle. |
Here's a script that recursively goes through a directory and fixes python files to use queue_size when creating publishers: https://gist.github.com/jonbinney/9299095 It takes the root directory as an argument, and the queue_size as an optional arg (defaults to 10). I've tested it on python2.7, and it seems to do the right thing (I tried it on the ros_comm_repo itself). |
The PR #372 implements the proposed warning. Please comment on that PR if you have an opinion on this (either you think it is a good or a bad idea). |
I asked for broader feedback on ros-users: http://lists.ros.org/lurker/message/20140306.015824.7333cfaf.en.html Waiting for feedback... |
Based in the discussion the warning was added. |
We kept the legacy behavior in #169 fix as default for stability.
For indigo we should make the new behavior default.
The text was updated successfully, but these errors were encountered: