RustGnuplot icon indicating copy to clipboard operation
RustGnuplot copied to clipboard

It seems that a process of gnuplot_qt still runs after the program exits

Open astrojhgu opened this issue 5 years ago • 3 comments

I wrote a program that uses gnuplot to plot data. After the program terminates normally there will remain a running gnuplot_qt process.

The code of the minimum test program is

use gnuplot::{Figure};

fn main() {
    let mut fig=Figure::new();
    fig.axes2d().lines(&[1,2,3,4],&[1,2,3,4],&[]);
    fig.show().unwrap();
}

Before running the program, I run following commands to ensure that all previously running gnuplot have already been killed:

for i in `pgrep gnuplot`
do
    kill -9 $i
done
pgrep gnuplot

Then I run the program as

cargo run 

Then the gnuplot window appears and I close it manually. Then the program exits normally.

I check the process by using

pgrep gnuplot

It shows that there is a running gnuplot_qt process.

I repeatly run my program and more gnuplot_qt will appear and keep running if I leave them alone.

The version of gnuplot crate I use is 0.0.37 and the gnuplot version in my system is gnuplot 5.2 patchlevel 8

astrojhgu avatar Nov 19 '20 06:11 astrojhgu

Hmm, I can reproduce this. I tried this in pure gnuplot, and it happened there too for the qt terminal, but not for x11 and wxt. I.e. running this script:

set terminal qt
plot x**2
pause mouse close
quit

gnuplot -p test.gnuplot

Also leaves a dangling gnuplot_qt process. It could be a gnuplot bug, or I (once again) don't understand how the -p option is meant to work.

SiegeLord avatar Nov 20 '20 05:11 SiegeLord

Thanks for the reply.

I confirmed that this happens for qt while x11 works well.

So I work around by switching the terminal to x11 each time in my rust program.

Hmm, I can reproduce this. I tried this in pure gnuplot, and it happened there too for the qt terminal, but not for x11 and wxt. I.e. running this script:

set terminal qt
plot x**2
pause mouse close
quit

gnuplot -p test.gnuplot

Also leaves a dangling gnuplot_qt process. It could be a gnuplot bug, or I (once again) don't understand how the -p option is meant to work.

astrojhgu avatar Nov 20 '20 05:11 astrojhgu

Ran into the same problem today, same gnuplot version (5.2.8). Indeed, this should be a gnuplot bug:

  • 5.4.2 release log mentions "FIX qt: prevent creation of zombie gnuplot_qt process Bug #2188", corresponding ticket;
  • to be sure, I built from source, and checkinstalled newer version of gnuplot - looks like there are no gnuplot zombie processes generated in my system now, at least for my code.

daniilsunyaev avatar Dec 25 '21 11:12 daniilsunyaev