pt-diskstats usage in non-interactive scripts

Bug #1021903 reported by justinb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Triaged
Undecided
Unassigned

Bug Description

I'm trying to run pt-diskstats as a collectd plugin because I like the information provided by this tool instead of iostat. The problem is when pt-diskstats is started up without being attached to the terminal, the parent (non data gathering) process uses %100 cpu. Strace output shows the following repeating very often.

select(8, [0], NULL, NULL, {1, 364751}) = 1 (in [0], left {1, 364744})
read(0, 0x133e400, 4096) = -1 EBADF (Bad file descriptor)
read(3, 0x1340860, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0x1340860, 4096) = -1 EAGAIN (Resource temporarily unavailable)
select(8, [0], NULL, NULL, {1, 364372}) = 1 (in [0], left {1, 364365})
read(0, 0x133e400, 4096) = -1 EBADF (Bad file descriptor)
read(3, 0x1340860, 4096) = -1 EAGAIN (Resource temporarily unavailable)
read(3, 0x1340860, 4096) = -1 EAGAIN (Resource temporarily unavailable)

Attached is a full strace output of the following command:
PTDEBUG=1 strace -ttt -s 1024 -o diskstats.strace -f nohup perl /usr/bin/pt-diskstats --iterations 2

And a Devel::NYTProf html and original output of the following:

perl -d:NYTProf /usr/bin/pt-diskstats --iterations 2

nohup perl -d:NYTProf /usr/bin/pt-diskstats --iterations 2

My System:

[root@pt ~]# uname -a
Linux pt 2.6.32-220.23.1.el6.x86_64 #1 SMP Mon Jun 18 18:58:52 BST 2012 x86_64 x86_64 x86_64 GNU/Linux
[root@pt ~]# cat /etc/redhat-release
CentOS release 6.2 (Final)

Replicated on Debian Squeeze

I know the intent of this script is to run in an interactive way however the data is too good not to trend in someway, which is done non-interactively.

Tags: pt-diskstats
Revision history for this message
justinb (jburnham25) wrote :
Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

You can run it as

perl /usr/bin/pt-diskstats --iterations 2 < /dev/null (with nohup etc.)

as a workaround.

However, http://sprunge.us/KNXc?pl can be added to pt-diskstats I guess, to prevent non-interactive use at all. (since the script is primarily interactive).

Changed in percona-toolkit:
status: New → Triaged
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-1002

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.