Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

changed error message for single threaded spinner #1164

Merged
dirk-thomas merged 3 commits intoros:lunar-develfrom
jgueldenstein:multithreaded-spinner-comment
Dec 13, 2017
Merged

changed error message for single threaded spinner #1164
dirk-thomas merged 3 commits intoros:lunar-develfrom
jgueldenstein:multithreaded-spinner-comment

Conversation

@jgueldenstein
Copy link
Copy Markdown
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?

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
Copy Markdown
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
@jgueldenstein jgueldenstein force-pushed the multithreaded-spinner-comment branch from 9f35bcf to e04469a Compare October 16, 2017 09:25
@jgueldenstein jgueldenstein reopened this Dec 5, 2017
Copy link
Copy Markdown
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
Copy Markdown
Contributor

v4hn commented Dec 5, 2017 via email

@v4hn
Copy link
Copy Markdown
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.

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
Copy Markdown
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
Copy Markdown
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants