pt-ioprofile doesn't run without a file

Bug #925778 reported by Frederic Descamps
6
This bug affects 1 person
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("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/gawk.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 5593] open("/usr/share/locale/en_US.utf8/LC_MESSAGES/gawk.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 5593] open("/usr/share/locale/en_US/LC_MESSAGES/gawk.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 5593] open("/usr/share/locale/en.UTF-8/LC_MESSAGES/gawk.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 5593] open("/usr/share/locale/en.utf8/LC_MESSAGES/gawk.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 5593] open("/usr/share/locale/en/LC_MESSAGES/gawk.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 5593] read(3, "", 3549) = 0
[pid 5593] close(3) = 0
[pid 5593] fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
[pid 5593] ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
[pid 5593] fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
[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=S_IFREG|0755, st_size=50416, ...}) = 0
stat("/bin/cat", {st_mode=S_IFREG|0755, st_size=50416, ...}) = 0
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/cat", X_OK) = 0
stat("/bin/cat", {st_mode=S_IFREG|0755, st_size=50416, ...}) = 0
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/cat", R_OK) = 0
stat("/bin/cat", {st_mode=S_IFREG|0755, st_size=50416, ...}) = 0
stat("/bin/cat", {st_mode=S_IFREG|0755, st_size=50416, ...}) = 0
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/cat", X_OK) = 0
stat("/bin/cat", {st_mode=S_IFREG|0755, st_size=50416, ...}) = 0
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/cat", R_OK) = 0
rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [INT CHLD], 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT CHLD], NULL, 8) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fd3efe129d0) = 29888
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGINT, {0x43e4a0, [], SA_RESTORER, 0x3803436300}, {SIG_DFL, [], SA_RESTORER, 0x3803436300}, 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 29888
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- {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(0xffffffffffffffff) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x3803436300}, {0x43e4a0, [], SA_RESTORER, 0x3803436300}, 8) = 0
stat(".", {st_mode=S_IFDIR|0550, st_size=4096, ...}) = 0
stat("/usr/local/sbin/awk", 0x7fffe196b5a0) = -1 ENOENT (No such file or directory)
stat("/usr/local/bin/awk", 0x7fffe196b5a0) = -1 ENOENT (No such file or directory)
stat("/sbin/awk", 0x7fffe196b5a0) = -1 ENOENT (No such file or directory)
stat("/bin/awk", {st_mode=S_IFREG|0755, st_size=417848, ...}) = 0
stat("/bin/awk", {st_mode=S_IFREG|0755, st_size=417848, ...}) = 0
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/awk", X_OK) = 0
stat("/bin/awk", {st_mode=S_IFREG|0755, st_size=417848, ...}) = 0
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/awk", R_OK) = 0
stat("/bin/awk", {st_mode=S_IFREG|0755, st_size=417848, ...}) = 0
stat("/bin/awk", {st_mode=S_IFREG|0755, st_size=417848, ...}) = 0
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/awk", X_OK) = 0
stat("/bin/awk", {st_mode=S_IFREG|0755, st_size=417848, ...}) = 0
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/bin/awk", R_OK) = 0
rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fd3efe129d0) = 29889
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGINT, {0x43e4a0, [], SA_RESTORER, 0x3803436300}, {SIG_DFL, [], SA_RESTORER, 0x3803436300}, 8) = 0
wait4(-1,

Tags: pt-ioprofile
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

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

Changed in percona-toolkit:
importance: Undecided → High
status: New → In Progress
assignee: nobody → Daniel Nichter (daniel-nichter)
milestone: none → 2.0.3
tags: added: pt-ioprofile
summary: - pt-ioprofile stalled
+ pt-ioprofile doesn't run without a file
Changed in percona-toolkit:
status: In Progress → Fix Committed
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

Also tested that short options work, e.g. -b for --profile-process. pt-ioprofile uses the new Bash libs, parse_options.sh in this case, so its option parsing should be first class.

Changed in percona-toolkit:
status: Fix Committed → Fix Released
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-292

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.