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

Can dds_take(...) return 0 in data_available? #154

Closed
qqqshengwei opened this issue Apr 12, 2019 · 2 comments
Closed

Can dds_take(...) return 0 in data_available? #154

qqqshengwei opened this issue Apr 12, 2019 · 2 comments

Comments

@qqqshengwei
Copy link

Hi! I put one write and one reader in a single participant. I set Qos DDS_DURABILITY_TRANSIENT_LOCAL, DDS_RELIABILITY_BEST_EFFORT with 0.01s and DDS_HISTORY_KEEP_ALL with 0 to both writer and reader. Also, I set them a listener. At last, I start 50 participants to make them talk with each other and theirselves. I found dds_take(...) would return 0 in data_available. Is it right or an error?

@qqqshengwei
Copy link
Author

I found for (int j = 0; !dds_triggered (waitSet) && j < samplecount; j++) in ping/pong demo and I wonder if samplecount could be zero and what happen. Thx.

@eboasson
Copy link
Contributor

I put one write and one reader in a single participant. I set Qos DDS_DURABILITY_TRANSIENT_LOCAL, DDS_RELIABILITY_BEST_EFFORT with 0.01s

That combination doesn't work: transient-local depends on the retransmit mechanism and the infrastructure for doing retransmits is not even created for best-effort readers/writers. One could consider making it possible to use the combination ... but I have never really given thought to how exactly that might work.

and DDS_HISTORY_KEEP_ALL with 0 to both writer and reader. Also, I set them a listener. At last, I start 50 participants to make them talk with each other and theirselves. I found dds_take(...) would return 0 in data_available. Is it right or an error?

I would generally not expect data_available to trigger unless something arrived and there is something to take (apart from some weird edge cases, such as with a very short setting for lifespan once that is implemented). At the same time, I am generally not against the odd spurious trigger, but only if those spurious triggers are really rare.

So at the very least I'd like to understand what exactly causes it to trigger here. Can you share the test program? That might be the easiest way.

I found for (int j = 0; !dds_triggered (waitSet) && j < samplecount; j++) in ping/pong demo and I wonder if samplecount could be zero and what happen. Thx.

It can be zero because ping/pong is a little bit of a mess 😟

As discussed above, I would generally not expect it to be zero when it is invoked as the "data available" listener, but in ping/pong it can be invoked either as the listener or from the main function whenever the call to dds_waitset_wait returns. The waitset can triggered either by the arrival of a sample (in which case I would not expect it to be 0) or by the signal handler. In the latter case, it could definitely be zero.

and what happen

I wouldn't expect anything unusual to happen if dds_take returns 0.

hsgwa pushed a commit to hsgwa/cyclonedds that referenced this issue Feb 9, 2021
* correct fallthrough macro

Signed-off-by: Karsten Knese <karsten@openrobotics.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants