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

sample given to setDataSample seem to sometimes "leak" to the other side #319

Open
doudou opened this issue Mar 28, 2020 · 3 comments
Open

Comments

@doudou
Copy link
Contributor

doudou commented Mar 28, 2020

While integrating a component that would setDataSample its outputs in configureHook,
I noticed that the sample I gave to setDataSample would end up read by the other side.

(for reference: rock-control/control-orogen-motor_controller@dd14ca6)

In this particular instance, I am fairly sure that setDataSample
is the problem - even though I haven't debugged it fully:

  • the issue was happenning consistently at first start of the component.
    However, removing setDataSample made it disappear.
  • the sample received on the other side has a non-empty 'names'
    field, while the names vector is empty for all other samples sent by
    the component

The same caveat than in #318 applies here: it might be an old already fixed bug, due to the fact that Rock is stuck to an old RTT commit because of #302

@doudou doudou changed the title setDataSample seem to sometimes "leak" to the other side sample given to setDataSample seem to sometimes "leak" to the other side Mar 28, 2020
@meyerj
Copy link
Member

meyerj commented Mar 28, 2020

I think this is "by design": The data sample is not stored separately in data elements and buffers, only in the OutputPort<T> instance. setDataSample() is almost equivalent to write() in the way it is pushed through the channel pipeline. The only difference is that buffers or lock-free data objects use the sample to reinitialize all their internal storage, and that it should not trigger a NewData read or port events on the output side of the channel (the InputPort).

The exact behavior of a read() depends on the type of connection (data/buffer, locked or lock-free).

Is the sample returned by the input port with FlowStatus NewData? If yes that would be a bug indeed.

Do you read with copy_old_data set to true (the default)?

@ahoarau
Copy link
Contributor

ahoarau commented Mar 29, 2020

I remember having seen this problem a while ago, but appeared to be fixed (?)

@doudou
Copy link
Contributor Author

doudou commented Mar 30, 2020

It might be with OldData. I consider it a bug either way, maybe an "intended behavior" because of how things have been implemented, but having an OldData that is an invalid sample (because only for initialization) is pretty bad.

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

3 participants