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

Terminate lrauv-application cleanly #4

Closed
mabelzhang opened this issue Aug 20, 2021 · 5 comments
Closed

Terminate lrauv-application cleanly #4

mabelzhang opened this issue Aug 20, 2021 · 5 comments

Comments

@mabelzhang
Copy link
Collaborator

mabelzhang commented Aug 20, 2021

Expected behavior

lrauv-application should terminate cleanly on exit or quit commands.

Actual behavior

Currently, the lrauv-application does not terminate cleanly when running with Ignition. This only happens when running with Ignition.
When quit or exit is issued, the command prompt hangs:

> quit
>

Ctrl+C is needed to terminate the program.

Initial investigation found that ign-transport has a singleton node that is not meant to be terminated, and the destructors are clean.

There could be a mismatch in expectations, where ign-transport does not intend to terminate, but the lrauv-application's tear-down procedure expects all threads to terminate and waits for the ign-transport thread to merge, which never happens.

Who even cares

Clean termination is useful for automated tests such as in osrf/lrauv_private#82, which are currently force-terminating the program.
It is also useful to know when all the log files are written and closed properly, which is guaranteed on a clean termination.

Suggestions of how to start

@caguero and @braanan know better where exactly the lines are in the code in ign-transport and lrauv-application, respectively.

@chapulina chapulina transferred this issue from another repository Nov 2, 2021
@chapulina
Copy link
Contributor

chapulina commented Dec 17, 2021

Here's a related upstream issue: gazebosim/gz-transport#101

@mabelzhang
Copy link
Collaborator Author

Wow, I think that issue was forgotten, because it never came up when we first looked into the issue.

@chapulina
Copy link
Contributor

I spent some time looking into it today. Not getting rid of the singleton completely, but tried to add a helper function to terminate all threads. After a couple hours I gave up 🙃

@braanan
Copy link
Collaborator

braanan commented Dec 18, 2021

Thanks for sharing and taking a look. I also tried creating the transport context on the heap and actively deleting in the destructor. That didn't work. The next thing I'd like to verify is if the issue happens when we only have one transport instance in the app - one thing we could try is creating a transport singleton in the application with accessor functions like we do with our LCM instance.

@braanan braanan closed this as completed Jan 12, 2022
@braanan
Copy link
Collaborator

braanan commented Jan 12, 2022

This issue is resolved following the removal of pthread_exit in lrauv-application main.

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