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

Fix use of shmem and unix_stream carriers in remote_controlboard and multipleanalogsensorclient network wrapper clients #3147

Merged

Conversation

traversaro
Copy link
Member

@traversaro traversaro commented Oct 25, 2024

In the context of walking, inside the ergocub-torso we are interested in establishing connection that continue to run even if the network interface over which they are established temporary goes down. The rationale for this is that at the moment in most demos we run the yarpserver in the operator laptop and the walking and the robot robotinterface inside the ergocub-torso board embedded in the robot, and while walking the robot could loose the connection with the operator laptop where the yarpserver is running.

To do so, we experimented with using shmem and unix_stream carriers, experiencing the following problems:

  • For shmem, sometimes there was a segfault on one of the two sides of the connection when the shmem connection was disconnected.
  • For unix_stream, it was not possible to open a connection via the multipleanalogsensorsclient.

This PR fixes all these problems, in particular:

  • Fix the segfault when shmem is disconnected by adding a generic mutex for the overall class, to ensure that it is not possible that a thread is calling on ShmemInputStreamImpl::write and that calls gets preempted by another thread that is calling ShmemInputStreamImpl::close and that is destryong the attributes that ShmemInputStreamImpl::write was using, that was the reason for our segfaults.
  • For multipleanalogsensorsclient, we were using the carrier parameter also for the rpc connection, but that is not aligned with other nwc, so we switched to always use tcp for rpc connection as it happens for remote_controlboard. I am not sure if the rpc not working over unix_stream is expected or not, but anyhow modifying multipleanalogsensorsclient to be more similar to other nwc made sense to me anyhow. See also the related comment New carrier option for yarp clients connections #2716 (comment) .

Furthermore, in this PR we also use the GENERATE functionality of catch to ensure that the multipleanalogsensorsclient and remotecontrolboardremapper tests are running on all the following carriers:tcp,fast_tcp,shmem,unix_stream

The testing part was dropped as it was also exposed some existing issues that are hard to debug and for which the fix had to touch the internal behaviour of YARP's Port, with an high chance of regressions. For reference, those attempts are documented in the comment in this PRs (that are not hidden as outdated) and the related code is https://github.com/traversaro/yarp/tree/archiveattemptofixvalgrind .

Copy link

update-docs bot commented Oct 25, 2024

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would update the release notes by adding a file in doc/release/<target_branch>, based on your changes.

@traversaro
Copy link
Member Author

fyi @S-Dafarra @GiulioRomualdi

Nicogene
Nicogene previously approved these changes Oct 25, 2024
@traversaro

This comment was marked as outdated.

@traversaro

This comment was marked as outdated.

@traversaro

This comment was marked as outdated.

@traversaro

This comment was marked as outdated.

@traversaro

This comment was marked as outdated.

@traversaro

This comment was marked as outdated.

@traversaro

This comment was marked as outdated.

@traversaro

This comment was marked as outdated.

@traversaro

This comment was marked as outdated.

@traversaro traversaro changed the title Fix and add tests for use of shmem and unix_stream carriers in remote_controlboard and multipleanalogsensorclient network wrapper clients Fix use of shmem and unix_stream carriers in remote_controlboard and multipleanalogsensorclient network wrapper clients Oct 27, 2024
@traversaro

This comment was marked as outdated.

@traversaro traversaro force-pushed the fixshmemunixstreamcarriersfornwc branch from f06ba95 to b7fd30a Compare October 27, 2024 17:05
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
D Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

@randaz81 randaz81 self-assigned this Nov 12, 2024
@randaz81 randaz81 added this to the YARP 3.10.0 milestone Nov 12, 2024
@randaz81 randaz81 merged commit 91decec into robotology:master Nov 12, 2024
46 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants