Skip to content
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

changed error message for single threaded spinner #1164

Merged

Conversation

jgueldenstein
Copy link
Contributor

added hint to use MultiThreadedSpinner when starting a single threaded spinner failed because it was on the same queue as a previously started AsyncSpinner.

This behavior was tolerated in kinetic but recommended against.

We would also like to add a similar message to the kinetic-devel branch.
Would you support this too?

@@ -130,7 +130,7 @@ void SingleThreadedSpinner::spin(CallbackQueue* queue)

if (!spinner_monitor.add(queue, true))
{
ROS_FATAL_STREAM("SingleThreadedSpinner: " << DEFAULT_ERROR_MESSAGE);
ROS_FATAL_STREAM("SingleThreadedSpinner: " << DEFAULT_ERROR_MESSAGE << " You might want to use a MultiThreadedSpinner instead.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this critically, I think we probably want to go a bit further and update the language elsewhere. In particular, the second sentence of DEFAULT_ERROR_MESSAGE doesn't seem to make much sense anymore:

const std::string DEFAULT_ERROR_MESSAGE =
    "Attempt to spin a callback queue from two spinners, one of them being single-threaded. "
    "This will probably result in callbacks being executed out-of-order.";

Since we are throwing a std::runtime_error directly afterwards (and thus, nothing will be happening, in-order or out-of-order). Further, it seems like we should probably use the same string both in the ROS_FATAL_STREAM and as the string we use during the throw (though this string would be different depend on whether this is SingleThreadedSpinner::spin or AsyncSpinnerImpl::start. Would you mind cleaning up those while we are doing this? Thanks.

…the same and not imply that spinning was successful when mixing single threaded spinner with multi/async spinners
Copy link
Member

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current patch doesn't compile.

Please make sure that patches build locally for you and pass the tests before creating PRs.

@v4hn
Copy link
Contributor

v4hn commented Dec 5, 2017 via email

@v4hn
Copy link
Contributor

v4hn commented Dec 13, 2017

Ping @dirk-thomas @clalancette

@jgueldenstein fixed the problems with this request and CI passed last week.
We would like to have this upstream to help our students use ROS correctly.
Please re-review and if possible merge.

@@ -113,8 +113,7 @@ struct SpinnerMonitor

SpinnerMonitor spinner_monitor;
const std::string DEFAULT_ERROR_MESSAGE =
"Attempt to spin a callback queue from two spinners, one of them being single-threaded. "
"This will probably result in callbacks being executed out-of-order.";
"Attempt to spin a callback queue from two spinners, one of them being single-threaded. ";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the trailing space between the dot and the closing quote.

@dirk-thomas
Copy link
Member

Thank you for the patch and for iterating on it.

@dirk-thomas dirk-thomas merged commit e9ae64a into ros:lunar-devel Dec 13, 2017
dirk-thomas pushed a commit that referenced this pull request Feb 9, 2018
* not imply that spinning was successful when mixing single threaded spinner with multi/async spinners

* updated error messages to reflect behavior when calling a singlethreaded spinner alongside a multithreaded one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants