# Being in julia and killing julia in package manager (\]) stops not all subprocesses resulting in problems later

**URL:** <https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175>\
**Category:** General Usage\
**Created:** [May 9, 2020, 11:29am UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175 "2020-05-09T11:29:33Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![DKad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dkad/32/203663_2.png) [@DKad](https://discourse.julialang.org/u/DKad)\
**Post date:** [May 9, 2020, 11:29am UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/1 "2020-05-09T11:29:33Z")

</div>

I have started julia REPL (v.1.4.1), went into the packet manager, ran update and finally stopped julia inside the packet manager with Ctrl-D. Unfortunately not all processes were stopped. I still had a process running:  
6426 ? S 0:00 /home/ad08/.julia/packages/GR/cRdXQ/src/…/deps/gr/bin/gksqt -session 10d8d4d463000158897755000000032610042\_1589008042\_573973  
Formerly the same problem interfered with plot() with the effect that I could not plot in the REPL. Of course I can kill this process and start julia again but I think this is no good solution.

---

<div class="post-metadata">

**Author:** ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)\
**Post date:** [May 10, 2020, 6:58am UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/2 "2020-05-10T06:58:44Z")

</div>

Which OS is this on? Also, cc @jheinen, since this looks like an issue with GR.

Does this persist after a restart?

---

<div class="post-metadata">

**Author:** ![DKad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dkad/32/203663_2.png) [@DKad](https://discourse.julialang.org/u/DKad)\
**Post date:** [May 10, 2020, 9:04am UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/3 "2020-05-10T09:04:59Z")

</div>

@jheinen:  
My OS is OpenSuse Linux 15.1. This morning I repeated the same procedure, started julia REPL, went to pkg\>, update (with an error in Libtask, but this seems to be irrelevant). Then I killed in the packet manager julia with Ctrl-D.  
Again I had a process still running:  
2838 ? S 0:00 /home/ad08/.julia/packages/GR/cRdXQ/src/…/deps/gr/bin/gksqt -session 10d8d4d463000158902597300000062230017\_1589063690\_94672

I think the casual user does not know what to do and he cannot solve spurious errors. I for myself do not know how to solve this problem.

---

<div class="post-metadata">

**Author:** ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)\
**Post date:** [May 10, 2020, 10:35pm UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/4 "2020-05-10T22:35:57Z")

</div>

Did you make a GR plot before starting Pkg? What do you mean with: Then I killed in the packet manager julia with Ctrl-D?

Can you manually close GKS QtTerm?

---

<div class="post-metadata">

**Author:** ![DKad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dkad/32/203663_2.png) [@DKad](https://discourse.julialang.org/u/DKad)\
**Post date:** [May 10, 2020, 10:50pm UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/5 "2020-05-10T22:50:20Z")

</div>

Here is what I did (I had the same problem days before):

1. I started my computer, then in a konsole
2. julia
3. ]
4. update
5. Ctrl-D  
ps xa | grep julia  
with the effect as in my original mail. I had this problem days before and now tried to repeat it. My OS has not marked subprocess 2838 as zombie. I suspect starting julia again and trying to plot has the effect that some call leads to nowhere. The konsole can only be recovered by killing julia explicitely.  
How can I manually close GKS QtTerm? I don’t understand.

---

<div class="post-metadata">

**Author:** ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)\
**Post date:** [May 11, 2020, 4:54am UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/6 "2020-05-11T04:54:57Z")

</div>

I have never seen this before. Do you have a startup file for Julia which (auto-)imports Plots (or GR)?

You can (manually) close the GKS QtTerm like any other Qt app via the window manager. Don’t know which window manager you have.

Does the issue also occur in normal operation?

```julia
using GR
plot(rand(5))
<Ctrl-D>

```

---

<div class="post-metadata">

**Author:** ![DKad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dkad/32/203663_2.png) [@DKad](https://discourse.julialang.org/u/DKad)\
**Post date:** [May 11, 2020, 7:46am UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/7 "2020-05-11T07:46:26Z")

</div>

It’s really strange. I started my system in the usual way and looked for the subprocess julia (without starting julia ever before!). As before I found  
2941 ? S 0:00 /home/ad08/.julia/packages/GR/cRdXQ/src/…/deps/gr/bin/gksq  
…  
and immediately before  
2937 pts/4 Ss 0:00 /bin/bash  
and I don’t know what this is doing. .bashrc is unsuspicious.  
Now I think it cannot be a problem of julia, since after  
julia  
using GR  
plot(rand(5))  
Ctrl-D

I saw the plot and the subprocess 2941 has vanished. Strange!

---

<div class="post-metadata">

**Author:** ![DKad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dkad/32/203663_2.png) [@DKad](https://discourse.julialang.org/u/DKad)\
**Post date:** [May 11, 2020, 10:37am UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/8 "2020-05-11T10:37:19Z")

</div>

The following gives no explanation why I have the problems with the strange subprocess.  
I only noticed an error in  
ldd libqt4gr.so  
with the notice that libGR.so is not found. libGR3.so and libGRM.so find libGR.so

Maybe irrelevant, I don’t know. I’m still seeking for a process which may have started julia. .bashrc or .profilerc do not contain any suspicious command. Is my system hacked?

---

<div class="post-metadata">

**Author:** ![DKad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dkad/32/203663_2.png) [@DKad](https://discourse.julialang.org/u/DKad)\
**Post date:** [May 12, 2020, 10:16am UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/9 "2020-05-12T10:16:59Z")

</div>

@jheinen I think I can show the problem with some simple lines: Start julia, then

using Plots  
plot(rand(10)) ; savefig(“Random.pdf”)

and stop julia. Random.pdf is generated and a process  
4072 pts/2 S 0:00 /home/ad08/.julia/packages/GR/cRdXQ/src/…/deps/gr/bin/gksqt  
is left, which even survives a reboot.  
This does not happen with:  
using GR

---

<div class="post-metadata">

**Author:** ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)\
**Post date:** [May 12, 2020, 12:48pm UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/10 "2020-05-12T12:48:07Z")

</div>

Could you please try the following logic:

```julia
using Plots
ENV["GKSwstype"] = "100"
plot(rand(10)) ; savefig(“Random.pdf”)

```

There is some logic within `Plots` that “contacts” the output device (in your case the default GR output device `gksqt`) before any plot is done. I’ve never understood why.

Seems to be related to the positioning of the viewport with regard to the axes labels and other text objects …

---

<div class="post-metadata">

**Author:** ![DKad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dkad/32/203663_2.png) [@DKad](https://discourse.julialang.org/u/DKad)\
**Post date:** [May 12, 2020, 1:09pm UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/11 "2020-05-12T13:09:38Z")

</div>

Maybe you’ve got it. Now I have no sleeping subprocess. I only don’t know what the difference is. Is “100” arbitrary?

---

<div class="post-metadata">

**Author:** ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)\
**Post date:** [May 12, 2020, 1:34pm UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/12 "2020-05-12T13:34:48Z")

</div>

Should we open an issue on Plots about this? If it’s leaving an orphan process that’s a problem.

---

<div class="post-metadata">

**Author:** ![DKad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dkad/32/203663_2.png) [@DKad](https://discourse.julialang.org/u/DKad)\
**Post date:** [May 12, 2020, 1:44pm UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/13 "2020-05-12T13:44:57Z")

</div>

Definitely yes! I’ve just rebooted my machine and the orphan process is still there (of course with changed PID). Maybe it’s a problem of KDE too. KDE seems to store the status of my machine. I’ve not done anything else. It would be interesting to know if other have this problem on Linux too, so that we can exclude malware.

---

<div class="post-metadata">

**Author:** ![DKad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dkad/32/203663_2.png) [@DKad](https://discourse.julialang.org/u/DKad)\
**Post date:** [May 12, 2020, 1:59pm UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/14 "2020-05-12T13:59:54Z")

</div>

@pixel27 Here you find more information concerning my issue with viruses on GitHub.

---

<div class="post-metadata">

**Author:** ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)\
**Post date:** [May 12, 2020, 2:30pm UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/15 "2020-05-12T14:30:02Z")

</div>

I suspect `Plots` calls some `GR` function before the first plot is shown (or saved). It might be a function to calculate the text height - I don’t know. Would be helpful if someone could debug it and point me to the corresponding code section - I could then try to fix it …

That would be easier than to “reverse engineer” it in `GR` …

---

<div class="post-metadata">

**Author:** ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)\
**Post date:** [May 12, 2020, 5:04pm UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/16 "2020-05-12T17:04:17Z")

</div>

all code in the GR backend code that is not in a display/show function is in [this function](https://github.com/JuliaPlots/Plots.jl/blob/238aca6a7849df448237019231180c944bf3f244/src/backends/gr.jl#L783).

---

<div class="post-metadata">

**Author:** ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)\
**Post date:** [May 13, 2020, 8:46am UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/17 "2020-05-13T08:46:55Z")

</div>

Unfortunately, I can’t fix this problem in `GR`. Before `Plots` creates the first plot, it calculates the padding for the plot. This is done by measuring the text sizes of axis labels and annotations, which again is inquired from GR text functions (`inqmathtex`, `inqtextext`, `inqtext`) using the required attributes (character height, char up vector, …). All this is done in the method `_update_min_padding`. So this issue can only be solved, if those calculations are “postponed” to the time, when the first output is really created.

That also explains, why `ENV["GKSwstype"] = "100"` has to be set on headless systems, e.g. when running the tests.

Although I wrote the first version of this backend, I honestly don’t trust myself to make this change to the current backend code without side effects because the code has changed a lot.

---

<div class="post-metadata">

**Author:** ![DKad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dkad/32/203663_2.png) [@DKad](https://discourse.julialang.org/u/DKad)\
**Post date:** [May 13, 2020, 8:59am UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/18 "2020-05-13T08:59:17Z")

</div>

As a consequence I have to put ENV[“GKSwstype”] = “100” in my startup.jl. This seems to work at least for me. Not important: Is there something special about the value 100?

---

<div class="post-metadata">

**Author:** ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)\
**Post date:** [May 13, 2020, 9:04am UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/19 "2020-05-13T09:04:16Z")

</div>

It’s kind of a NULL output device

---

<div class="post-metadata">

**Author:** ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)\
**Post date:** [May 13, 2020, 9:13am UTC](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175/20 "2020-05-13T09:13:52Z")

</div>

Would the measured padding be the same across all devices? We could then wrap that function in `withenv("GKSwstype" => "100")`.

[Next page](https://discourse.julialang.org/t/being-in-julia-and-killing-julia-in-package-manager-stops-not-all-subprocesses-resulting-in-problems-later/39175.md?page=2)
