pt-ioprofile doesn't run without a file
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
High
|
Daniel Nichter |
Bug Description
pt-ioprofile doesn't stop and run forever without output.
Tested on Fedora 16, CentOS 6.1 and Mac OS X 10.
Version: 2.0.1
[root@percona1 ~]# ./pt-ioprofile --version
pt-iostats 2.0.1
Command line tested:
./pt-ioprofile
--> CTRL+C needed to stop and no output
[root@percona1 ~]# time ./pt-ioprofile (CTRL+D)
total filename
real 1m14.274s
user 0m0.801s
sys 0m1.610s
[root@percona1 ~]# ./pt-ioprofile -b mysqld
--> nothing
[root@percona1 ~]# ./pt-ioprofile -p `pidof mysqld`
--> nothing
On CentOS:
-------------
[root@percona1 ~]# strace -f ./pt-ioprofile
...
pid 5593] open("/
[pid 5593] open("/
[pid 5593] open("/
[pid 5593] open("/
[pid 5593] open("/
[pid 5593] open("/
[pid 5593] read(3, "", 3549) = 0
[pid 5593] close(3) = 0
[pid 5593] fstat(0, {st_mode=
[pid 5593] ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
[pid 5593] fstat(0, {st_mode=
[pid 5593] read(0,
--> it seems the program is waiting for STDINPUT ?
On Fedora:
------------
[root@lefred ~]# strace ./pt-ioprofile -b mysqld
....
stat("/bin/cat", {st_mode=
stat("/bin/cat", {st_mode=
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/cat", X_OK) = 0
stat("/bin/cat", {st_mode=
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/cat", R_OK) = 0
stat("/bin/cat", {st_mode=
stat("/bin/cat", {st_mode=
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/cat", X_OK) = 0
stat("/bin/cat", {st_mode=
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/cat", R_OK) = 0
rt_sigprocmask(
rt_sigprocmask(
rt_sigprocmask(
clone(child_
rt_sigprocmask(
rt_sigprocmask(
rt_sigprocmask(
rt_sigprocmask(
rt_sigaction(
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 29888
rt_sigprocmask(
--- {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=29888, si_status=0, si_utime=0, si_stime=0} (Child exited) ---
wait4(-1, 0x7fffe196af98, WNOHANG, NULL) = -1 ECHILD (No child processes)
rt_sigreturn(
rt_sigaction(
stat(".", {st_mode=
stat("/
stat("/
stat("/sbin/awk", 0x7fffe196b5a0) = -1 ENOENT (No such file or directory)
stat("/bin/awk", {st_mode=
stat("/bin/awk", {st_mode=
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/awk", X_OK) = 0
stat("/bin/awk", {st_mode=
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/awk", R_OK) = 0
stat("/bin/awk", {st_mode=
stat("/bin/awk", {st_mode=
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/awk", X_OK) = 0
stat("/bin/awk", {st_mode=
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/awk", R_OK) = 0
rt_sigprocmask(
clone(child_
rt_sigprocmask(
rt_sigprocmask(
rt_sigprocmask(
rt_sigprocmask(
rt_sigaction(
wait4(-1,
Related branches
summary: |
- pt-ioprofile stalled + pt-ioprofile doesn't run without a file |
Changed in percona-toolkit: | |
status: | In Progress → Fix Committed |
Changed in percona-toolkit: | |
status: | Fix Committed → Fix Released |
Alexey S. also reported this:
Without this patch pt-ioprofile just does nothing.
We call main() as main "$EXT_ARG" but even if $EXT_ARG="" Bash still counts it as an argument so $# will be 1.
--- /root/bin/ pt-ioprofile 2012-01-27 03:06:30.000000000 -0800
+++ pt-ioprofile 2012-01-27 03:34:34.464194538 -0800
@@ -539,7 +539,8 @@
}
main() {
- if [ $# -eq 0 ]; then
+
+ if [ $# -eq 1 -a -z "$1"]; then
# There's no file to analyze, so we'll make one.
if which strace > /dev/null 2>&1; then