|
From: Cook, R. <co...@ll...> - 2012-09-08 00:41:02
|
Hello,
I'm sorry for such an odd question as a newbie poster.
I have built and installed gnuplot and wrapped it in a wrapper script. The script simply makes a usage entry in a database, calls gnuplot, then notes that it exits. I'm including the script below.
Anyhow, when the user runs this script and puts it into the background, gnuplot immediately starts taking up 100% of a CPU, spinning in readline. This only happens when gnuplot is wrapped in this way, not when it's called directly. I would like to avoid this behavior, obviously, but I would also like to continue using a wrapper script. What is it about being called from a script that is causing this odd behavior on gnuplot's part?
Thanks.
Here's a stack trace from a debugger of gnuplot when it's hammering our CPU:
Stack Trace
tcsetattr, FP=7fffffffd060
rl_tty_unset_default_bindings, FP=7fffffffd080
rl_deprep_terminal, FP=7fffffffd090
rl_cleanup_after_signal, FP=7fffffffd0a0
rl_reset_after_signal, FP=7fffffffd140
rl_read_key, FP=7fffffffd160
readline_internal_char, FP=7fffffffd180
readline, FP=7fffffffd190
C read_line, FP=7fffffffd1e0
C com_line, FP=7fffffffd1f0
C main, FP=7fffffffd3e0
__libc_start_main, FP=7fffffffd4a0
_start, FP=7fffffffd4b0
Here's the wrapper script:
#!/usr/bin/env bash
IMG_TRACK=${IMG_TRACK:-/usr/local/tools/imgtrack-1.0/bin/imgtrack}
if [ -f $IMG_TRACK ]; then
$IMG_TRACK BEGIN gnuplot-4.4.3 $0 "$@"
fi
/usr/local/tools/gnuplot-4.4.3/bin/gnuplot.real "$@"
_value=$?
if [ -f $IMG_TRACK ]; then
$IMG_TRACK END gnuplot-4.4.3 $0 "$@"
fi
exit $_value
--
✐Richard Cook
✇ Lawrence Livermore National Laboratory
Bldg-453 Rm-4024, Mail Stop L-557
7000 East Avenue, Livermore, CA, 94550, USA
☎ (office) (925) 423-9605
☎ (fax) (925) 423-6961
---
Information Management & Graphics Grp., Services & Development Div., Integrated Computing & Communications Dept.
(opinions expressed herein are mine and not those of LLNL)
|
|
From: walter h. <wh...@bf...> - 2012-09-08 06:41:36
|
hi,
taking 100% cpu time is not a bad thing. that simply means it takes all powers
it can get to do its job. the problems start when you can not start a second programm
anymore because the system is so busy.
The first question is always:
does the latest version 4.6 behave the same ? (maybe the bug is fixed already)
to establish that libreadline is the problem, can you create a version of gnuplot without
libreadline ?
re,
wh
Am 08.09.2012 02:40, schrieb Cook, Rich:
> Hello,
> I'm sorry for such an odd question as a newbie poster.
> I have built and installed gnuplot and wrapped it in a wrapper script. The script simply makes a usage entry in a database, calls gnuplot, then notes that it exits. I'm including the script below.
>
> Anyhow, when the user runs this script and puts it into the background, gnuplot immediately starts taking up 100% of a CPU, spinning in readline. This only happens when gnuplot is wrapped in this way, not when it's called directly. I would like to avoid this behavior, obviously, but I would also like to continue using a wrapper script. What is it about being called from a script that is causing this odd behavior on gnuplot's part?
>
> Thanks.
>
> Here's a stack trace from a debugger of gnuplot when it's hammering our CPU:
> Stack Trace
> tcsetattr, FP=7fffffffd060
> rl_tty_unset_default_bindings, FP=7fffffffd080
> rl_deprep_terminal, FP=7fffffffd090
> rl_cleanup_after_signal, FP=7fffffffd0a0
> rl_reset_after_signal, FP=7fffffffd140
> rl_read_key, FP=7fffffffd160
> readline_internal_char, FP=7fffffffd180
> readline, FP=7fffffffd190
> C read_line, FP=7fffffffd1e0
> C com_line, FP=7fffffffd1f0
> C main, FP=7fffffffd3e0
> __libc_start_main, FP=7fffffffd4a0
> _start, FP=7fffffffd4b0
>
>
> Here's the wrapper script:
>
> #!/usr/bin/env bash
>
> IMG_TRACK=${IMG_TRACK:-/usr/local/tools/imgtrack-1.0/bin/imgtrack}
> if [ -f $IMG_TRACK ]; then
> $IMG_TRACK BEGIN gnuplot-4.4.3 $0 "$@"
> fi
> /usr/local/tools/gnuplot-4.4.3/bin/gnuplot.real "$@"
> _value=$?
> if [ -f $IMG_TRACK ]; then
> $IMG_TRACK END gnuplot-4.4.3 $0 "$@"
> fi
> exit $_value
>
>
>
|
|
From: Cook, R. <co...@ll...> - 2012-09-08 17:10:02
|
Sorry, I was not clear. This is not a desktop machine. This is a large cluster with many users and part of my role is to make gnuplot work well on it. Taking 100% cpu on the login node of our cluster with hundreds of users is a bad thing actually and we try to avoid it.
I tried gnuplot 4.6.0 and it has the same behavior.
Compiling without readline might or might not solve the problem, but creates a worse one in my view -- readline is a "necessary convenience." :-) I can also launch gnuplot without wrapping it in a shell script, but this again is not a desirable solution. Or we could use Tecplot instead, but gnuplot has some really sweet features and is very popular here.
My question is, what is it about being put into the background that causes gnuplot to spin up to 100% CPU looking for a keystroke?
Thanks
-- Rich
On Sep 7, 2012, at 11:41 PM, walter harms <wh...@bf...> wrote:
> hi,
> taking 100% cpu time is not a bad thing. that simply means it takes all powers
> it can get to do its job. the problems start when you can not start a second programm
> anymore because the system is so busy.
>
> The first question is always:
> does the latest version 4.6 behave the same ? (maybe the bug is fixed already)
>
> to establish that libreadline is the problem, can you create a version of gnuplot without
> libreadline ?
>
>
> re,
> wh
>
>
>
> Am 08.09.2012 02:40, schrieb Cook, Rich:
>> Hello,
>> I'm sorry for such an odd question as a newbie poster.
>> I have built and installed gnuplot and wrapped it in a wrapper script. The script simply makes a usage entry in a database, calls gnuplot, then notes that it exits. I'm including the script below.
>>
>> Anyhow, when the user runs this script and puts it into the background, gnuplot immediately starts taking up 100% of a CPU, spinning in readline. This only happens when gnuplot is wrapped in this way, not when it's called directly. I would like to avoid this behavior, obviously, but I would also like to continue using a wrapper script. What is it about being called from a script that is causing this odd behavior on gnuplot's part?
>>
>> Thanks.
>>
>> Here's a stack trace from a debugger of gnuplot when it's hammering our CPU:
>> Stack Trace
>> tcsetattr, FP=7fffffffd060
>> rl_tty_unset_default_bindings, FP=7fffffffd080
>> rl_deprep_terminal, FP=7fffffffd090
>> rl_cleanup_after_signal, FP=7fffffffd0a0
>> rl_reset_after_signal, FP=7fffffffd140
>> rl_read_key, FP=7fffffffd160
>> readline_internal_char, FP=7fffffffd180
>> readline, FP=7fffffffd190
>> C read_line, FP=7fffffffd1e0
>> C com_line, FP=7fffffffd1f0
>> C main, FP=7fffffffd3e0
>> __libc_start_main, FP=7fffffffd4a0
>> _start, FP=7fffffffd4b0
>>
>>
>> Here's the wrapper script:
>>
>> #!/usr/bin/env bash
>>
>> IMG_TRACK=${IMG_TRACK:-/usr/local/tools/imgtrack-1.0/bin/imgtrack}
>> if [ -f $IMG_TRACK ]; then
>> $IMG_TRACK BEGIN gnuplot-4.4.3 $0 "$@"
>> fi
>> /usr/local/tools/gnuplot-4.4.3/bin/gnuplot.real "$@"
>> _value=$?
>> if [ -f $IMG_TRACK ]; then
>> $IMG_TRACK END gnuplot-4.4.3 $0 "$@"
>> fi
>> exit $_value
>>
>>
>>
Rich Cook
--------------------------------------
There is no real you, only neurons firing. If you understand this, then you know you always have a choice. Buddha says, "Wake up."
--------------------------------------
|
|
From: Robert P. <rd...@gm...> - 2012-09-08 19:46:31
|
Spinning on readline when put into the background sounds vaguely familiar. To simplify things a bit, what happens in your environment when you run the following script: #!/usr/bin/env bash /usr/local/tools/gnuplot-4.4.3/bin/gnuplot.real "$@" _value=$? exit $_value ? And can you provide a minimal example of the command line args? - rdp |
|
From: Cook, R. <co...@ll...> - 2012-09-10 19:48:14
|
Thanks for the idea, Still spins even with that very simple script. The following script exhibits the same behavior: #!/usr/bin/env bash //usr/local/tools/gnuplot-4.4.3/bin/gnuplot.real "$@" I am not giving any command line arguments to the script, so "$@" is evaluating to "" On Sep 8, 2012, at 12:46 PM, Robert Poor wrote: > Spinning on readline when put into the background sounds vaguely > familiar. To simplify things a bit, what happens in your environment > when you run the following script: > > #!/usr/bin/env bash > /usr/local/tools/gnuplot-4.4.3/bin/gnuplot.real "$@" > _value=$? > exit $_value > > ? > > And can you provide a minimal example of the command line args? > > - rdp -- ✐Richard Cook ✇ Lawrence Livermore National Laboratory Bldg-453 Rm-4024, Mail Stop L-557 7000 East Avenue, Livermore, CA, 94550, USA ☎ (office) (925) 423-9605 ☎ (fax) (925) 423-6961 --- Information Management & Graphics Grp., Services & Development Div., Integrated Computing & Communications Dept. (opinions expressed herein are mine and not those of LLNL) |
|
From: Cook, R. <co...@ll...> - 2012-09-10 19:50:29
|
Almost the same thing happens if I use csh: #!/usr/bin/env csh //usr/local/tools/gnuplot-4.4.3/bin/gnuplot.real Very slight differences, but basically hitting control-C then fg in this case still derails gnuplot. My login shell is bash, so I suspect that's impacting things even when the script calls csh. On Sep 10, 2012, at 12:48 PM, Cook, Rich wrote: > Thanks for the idea, > Still spins even with that very simple script. The following script exhibits the same behavior: > > #!/usr/bin/env bash > //usr/local/tools/gnuplot-4.4.3/bin/gnuplot.real "$@" > > I am not giving any command line arguments to the script, so "$@" is evaluating to "" > > On Sep 8, 2012, at 12:46 PM, Robert Poor wrote: > >> Spinning on readline when put into the background sounds vaguely >> familiar. To simplify things a bit, what happens in your environment >> when you run the following script: >> >> #!/usr/bin/env bash >> /usr/local/tools/gnuplot-4.4.3/bin/gnuplot.real "$@" >> _value=$? >> exit $_value >> >> ? >> >> And can you provide a minimal example of the command line args? >> >> - rdp > > -- > ✐Richard Cook > ✇ Lawrence Livermore National Laboratory > Bldg-453 Rm-4024, Mail Stop L-557 > 7000 East Avenue, Livermore, CA, 94550, USA > ☎ (office) (925) 423-9605 > ☎ (fax) (925) 423-6961 > --- > Information Management & Graphics Grp., Services & Development Div., Integrated Computing & Communications Dept. > (opinions expressed herein are mine and not those of LLNL) > > > -- ✐Richard Cook ✇ Lawrence Livermore National Laboratory Bldg-453 Rm-4024, Mail Stop L-557 7000 East Avenue, Livermore, CA, 94550, USA ☎ (office) (925) 423-9605 ☎ (fax) (925) 423-6961 --- Information Management & Graphics Grp., Services & Development Div., Integrated Computing & Communications Dept. (opinions expressed herein are mine and not those of LLNL) |
|
From: Cook, R. <co...@ll...> - 2012-09-10 19:56:24
|
I used an account using csh and it gets the same behavior, so it looks like there is something about gnuplot in particular that causes this and it's not sensitive to the shell. On Sep 10, 2012, at 12:50 PM, Cook, Rich wrote: > Almost the same thing happens if I use csh: > > #!/usr/bin/env csh > //usr/local/tools/gnuplot-4.4.3/bin/gnuplot.real > > Very slight differences, but basically hitting control-C then fg in this case still derails gnuplot. > My login shell is bash, so I suspect that's impacting things even when the script calls csh. > > On Sep 10, 2012, at 12:48 PM, Cook, Rich wrote: > >> Thanks for the idea, >> Still spins even with that very simple script. The following script exhibits the same behavior: >> >> #!/usr/bin/env bash >> //usr/local/tools/gnuplot-4.4.3/bin/gnuplot.real "$@" >> >> I am not giving any command line arguments to the script, so "$@" is evaluating to "" >> >> On Sep 8, 2012, at 12:46 PM, Robert Poor wrote: >> >>> Spinning on readline when put into the background sounds vaguely >>> familiar. To simplify things a bit, what happens in your environment >>> when you run the following script: >>> >>> #!/usr/bin/env bash >>> /usr/local/tools/gnuplot-4.4.3/bin/gnuplot.real "$@" >>> _value=$? >>> exit $_value >>> >>> ? >>> >>> And can you provide a minimal example of the command line args? >>> >>> - rdp >> >> -- >> ✐Richard Cook >> ✇ Lawrence Livermore National Laboratory >> Bldg-453 Rm-4024, Mail Stop L-557 >> 7000 East Avenue, Livermore, CA, 94550, USA >> ☎ (office) (925) 423-9605 >> ☎ (fax) (925) 423-6961 >> --- >> Information Management & Graphics Grp., Services & Development Div., Integrated Computing & Communications Dept. >> (opinions expressed herein are mine and not those of LLNL) >> >> >> > > -- > ✐Richard Cook > ✇ Lawrence Livermore National Laboratory > Bldg-453 Rm-4024, Mail Stop L-557 > 7000 East Avenue, Livermore, CA, 94550, USA > ☎ (office) (925) 423-9605 > ☎ (fax) (925) 423-6961 > --- > Information Management & Graphics Grp., Services & Development Div., Integrated Computing & Communications Dept. > (opinions expressed herein are mine and not those of LLNL) > > > -- ✐Richard Cook ✇ Lawrence Livermore National Laboratory Bldg-453 Rm-4024, Mail Stop L-557 7000 East Avenue, Livermore, CA, 94550, USA ☎ (office) (925) 423-9605 ☎ (fax) (925) 423-6961 --- Information Management & Graphics Grp., Services & Development Div., Integrated Computing & Communications Dept. (opinions expressed herein are mine and not those of LLNL) |