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 subprocess handling #48

Merged
merged 16 commits into from
Mar 7, 2019
Merged

Fix subprocess handling #48

merged 16 commits into from
Mar 7, 2019

Conversation

at-wat
Copy link
Member

@at-wat at-wat commented Feb 25, 2019

fix #47
fix #49

@at-wat at-wat self-assigned this Feb 25, 2019
@at-wat at-wat changed the title Retry libypspur initialization Fix subprocess handling Mar 5, 2019
@at-wat at-wat mentioned this pull request Mar 5, 2019
2 tasks
{
std::vector<std::string> args;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing string processing after fork causes a kind of dead lock on strict environments like Alpine.

if (pid_ > 0)
{
ROS_INFO("killing ypspur-coordinator (%d)", (int)pid_);
kill(pid_, SIGINT);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without wait, child process goes zombie.

@at-wat at-wat requested a review from DaikiMaekawa March 7, 2019 03:43
@at-wat
Copy link
Member Author

at-wat commented Mar 7, 2019

@DaikiMaekawa please take a look

{
const int err = errno;
ROS_ERROR("failed to fork process: %s", strerror(err));
throw(std::string("failed to fork process"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you define a dedicated exception for these?
std::string could throw an exception during use.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many other part has same problem. I will fix them in separate PR. #51

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough.

args.push_back(param_file_);
}

char **argv = new char *[args.size() + 1];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is it released?

args.push_back(std::string("--admask"));
args.push_back(ad_mask);
args.push_back(std::string("--msq-key"));
args.push_back(std::to_string(key_));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the initializer list.

@at-wat at-wat mentioned this pull request Mar 7, 2019
2 tasks
@at-wat
Copy link
Member Author

at-wat commented Mar 7, 2019

@DaikiMaekawa addressed your comments. PTAL

Copy link
Member

@DaikiMaekawa DaikiMaekawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM

@at-wat at-wat merged commit 39db1e5 into master Mar 7, 2019
@at-wat at-wat deleted the retry-libypspur-init branch March 7, 2019 09:10
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

Successfully merging this pull request may close these issues.

Fix sub-process handling Fix libypspur initialize timing
2 participants