A Bug Inquiry in linux/tools/perf/builtin-record.c
Hi all,
There is a bug found in my work when running "perf record". The basic information is here. As we know, perf record is a parent process and the programme traced is a child process when running "perf record". Sometimes the child process become zombie state and disappear until the parent process is killed. The bug stays in linux/ tools/perf/builtin-record.c.
*********************************************************************
static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
......
if (hits == rec->samples) {
if (done)
break;
err = poll(evsel_list->pollfd, evsel_list->nr_fds, -1);
waking++;
}
......*********************************************************************
The parent process still call the functionpoll(evsel_list->pollfd, evsel_list->nr_fds, -1) when the child process has exited already, which caused a zombie process.
May I have your opinion ?
Waiting for your reply!
Best Regards
Kaixu Xia
Quoted 28 lines · xiakaixu
Hi all,
There is a bug found in my work when running "perf record". The basic information is here. As we know, perf record is a parent process and the programme traced is a child process when running "perf record". Sometimes the child process become zombie state and disappear until the parent process is killed. The bug stays in linux/
tools/perf/builtin-record.c.
*********************************************************************
static int__cmd_record(struct perf_record *rec, int argc, const char **argv)...... if (hits == rec->samples) { if (done) break; err = poll(evsel_list->pollfd, evsel_list->nr_fds, -1); waking++; } ......*********************************************************************
The parent process still call the functionpoll(evsel_list->pollfd, evsel_list->nr_fds, -1)when the child process has exited already, which caused a zombie process.May I have your opinion ?
Waiting for your reply!Best Regards
Kaixu Xia
Hi xiakaixu,
Quoted 23 lines
Quoted 22 lines · xiakaixu
Hi all,
There is a bug found in my work when running "perf record". The basic information is here. As we know, perf record is a parent process and the programme traced is a child process when running "perf record". Sometimes the child process become zombie state and disappear until the parent process is killed. The bug stays in linux/
tools/perf/builtin-record.c.
*********************************************************************
static int__cmd_record(struct perf_record *rec, int argc, const char **argv)...... if (hits == rec->samples) { if (done) break; err = poll(evsel_list->pollfd, evsel_list->nr_fds, -1); waking++; } ......*********************************************************************
The parent process still call the functionpoll(evsel_list->pollfd, evsel_list->nr_fds, -1)when the child process has exited already, which caused a zombie process.
Quoted 2 lines
Quoted 2 lines
May I have your opinion ?
Waiting for your reply!
Do you have a real bug report based on this?
AFAIK perf record installed a signal handler for SIGCHLD so it'll set the 'done' variable when child exits and then break the loop.
Thanks,
Namhyung
Hi Namhyung,
Quoted 25 lines · Namhyung Kim
Hi xiakaixu,
Quoted 23 lines
Quoted 22 lines · xiakaixu
Hi all,
There is a bug found in my work when running "perf record". The basic information is here. As we know, perf record is a parent process and the programme traced is a child process when running "perf record". Sometimes the child process become zombie state and disappear until the parent process is killed. The bug stays in linux/
tools/perf/builtin-record.c.
*********************************************************************
static int__cmd_record(struct perf_record *rec, int argc, const char **argv)...... if (hits == rec->samples) { if (done) break; err = poll(evsel_list->pollfd, evsel_list->nr_fds, -1); waking++; } ......*********************************************************************
The parent process still call the functionpoll(evsel_list->pollfd, evsel_list->nr_fds, -1)when the child process has exited already, which caused a zombie process.
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
May I have your opinion ?
Waiting for your reply!Do you have a real bug report based on this?
yeah, of course we have it, I'll be glad to provide it if necessary.
Quoted 3 lines
AFAIK perf record installed a signal handler for SIGCHLD so it'll set the 'done' variable when child exits and then break the loop.
yes, you are right. Though the 'done' varible will be set when child exits, there is time gap between "if(done)" statement and "poll(...)" function. The 'done' variable won't be judge when child exits in this time gap. You know this time gap is instruction level, so this bug is small probability. My solution is adding a while(...) statement outside poll(...) function.
Quoted 5 lines
Thanks,
Namhyung
.
Quoted 51 lines · xiakaixu
Hi Namhyung,
Quoted 25 lines · Namhyung Kim
Hi xiakaixu,
Quoted 23 lines
Quoted 22 lines · xiakaixu
Hi all,
There is a bug found in my work when running "perf record". The basic information is here. As we know, perf record is a parent process and the programme traced is a child process when running "perf record". Sometimes the child process become zombie state and disappear until the parent process is killed. The bug stays in linux/
tools/perf/builtin-record.c.
*********************************************************************
static int__cmd_record(struct perf_record *rec, int argc, const char **argv)...... if (hits == rec->samples) { if (done) break; err = poll(evsel_list->pollfd, evsel_list->nr_fds, -1); waking++; } ......*********************************************************************
The parent process still call the functionpoll(evsel_list->pollfd, evsel_list->nr_fds, -1)when the child process has exited already, which caused a zombie process.Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
May I have your opinion ?
Waiting for your reply!Do you have a real bug report based on this?
yeah, of course we have it, I'll be glad to provide it if necessary.
Quoted 3 lines
AFAIK perf record installed a signal handler for SIGCHLD so it'll set the 'done' variable when child exits and then break the loop.
yes, you are right. Though the 'done' varible will be set when child exits, there is time gap between "if(done)" statement and "poll(...)" function. The 'done' variable won't be judge when child exits in this time gap. You know this time gap is instruction level, so this bug is small probability. My solution is adding a while(...) statement outside poll(...) function.
Quoted 6 lines
Thanks,
Namhyung
.