Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
rospy publishers hang if one of their subscribers goes out of wifi range. After the TCP buffer to the non-responsive node fills up, writing data to the publisher's socket hangs, causing it to to block and causing other nodes to not receive data. To fix this, the queue_size parameter was added to rospy publishers a while back. It's been bad practice to use rospy publishers without setting queue_size for a while, but this fact hasn't been widely advertised.
With the queue_size argument set to some number, after buffering queue_size messages, messages to unresponsive nodes are dropped. This is almost always the desired behavior. rosbridge doesn't provide the queue_size param, so rospy defaults to the old, blocking style. Starting in indigo this will cause rospy to print a warning: ros/ros_comm#372
This PR sets the default queue_size to 100, but lets it be overridden by adding a queue_size parameter to the json message. I haven't implemented the rosjs side for this, but the default behavior should be what most people want.
To test this, it is useful to have a publisher that sends a lot of data to fill up the queue quickly. Try this: https://gist.github.com/jonbinney/9752997
First, start rosbridge. Second, connect to it with the provided webpage (publishes strings on cmd_vel). Now start two instances of
rostopic hz cmd_vel -w3
in two separate terminals. Hit ctrl-z to backround one of them, and after less than a minute the other will hang. After this PR, it won't hang.