-
Notifications
You must be signed in to change notification settings - Fork 20
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
Conversation
{ | ||
std::vector<std::string> args; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
@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")); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is it released?
src/ypspur_ros.cpp
Outdated
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_)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the initializer list.
@DaikiMaekawa addressed your comments. PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
fix #47
fix #49