Post High CPU Usage on Startup - VSCode OSX triggered my post. As the link mentions, the post was about "high-cpu-usage-on-startup-vscode-osx”. I responded but didn’t want to hijack that thread so deleted my post and decided to make it a separate post.
Since Julia 1.3 I have encountered many issues with stray/high cpu usage on Julia process. It should be said that this behavior is much more often observed in the many cases I run external programs (in my case cmdstan and GKSTerm).
I wonder if the high cpu usage is confined to vscode. I see similar issues with Sublime Text and TextMate once compilation of packages start. I don’t know if in vscode’s startup sequence compilation/package indexing might be triggered.
Also, is this behavior confined to OSX? Travis test runs often time out, occasionally while it is still resolving package versions. Could that be related?
On OSX, sometimes it takes many, many minutes before it returns and often it simply never returns (although I’m not sure I ever waited overnight :-). The Activity Monitor has become a goto tool…
A third issue I have seen is that the additional Julia processes indeed seem to persist after interrupting the REPL (sometimes much later on breaking in with an error message).
Finally, in many cases when I display a plot with Plots/GR Julia simply hangs. Even the REPL stops responding. The Julia process remains running. These days I only use Plots/GR where I use savefig() which prevents GKSTerm to be activated.
I see this on 1.3 and development versions 1.4 and 1.5. I don’t think I ever saw it before Julia 1.3.
It is unclear to me if these issues are related or separate issues.
Until last week I thought it was an issue with my machine, but now I’ve quadrupled memory, disk space and cores.
Isn’t it called macOS now?
This may be relevant, I mean: It may be relevant which exact version of macOS this happens.
Other macOS users ( I am not one) may post their similar or not experience and some patterns may show up.
about these processes, what exactly you mean by “stray” (eg output from pstree),
the environment variables you use for setting the number of threads/parallell
An MWE would definitely be helpful, then running it with parallelization disabled, then finally in 1.2.
Possibly — comments from people could help you narrow it down. But coming up with some kind of script, even if not minimal, that reliably reproduces this on your machine would probably help a lot.
The problems have been there on Mojave as well. If in doubt if it is Julia’s under development version I always go back to the current released version of Julia (1.3.1 currently).
Without a MWE/reproducable example, the post is indeed intended to see if it is just my machine/me or if these are more common issues.
Look in macOS activity monitor for Julia processes that use a lot of cpu, then you can look what file they opened (in the “Open Files and Ports” tab) and check if you see something related to the language server.
Maybe. I’m not sure what the open port to julia-codegen really means.
But, as often is the case, just asking a question helped. For a long time (7 years already!?!) I used a few definitions like below (importing Base.* of course):
function *(c1::Cmd, c2::Cmd)
res = deepcopy(c1)
for i in 1:length(c2.exec)
push!(res.exec, c2.exec[i])
end
res
end
function *(c1::Cmd, sa::Array{String, 1})
res = deepcopy(c1)
for i in 1:length(sa)
push!(res.exec, sa[i])
end
res
end
function *(c1::Cmd, s::String)
res = deepcopy(c1)
push!(res.exec, s)
res
end
and this I think is no longer possible in Julia 1.3 and higher. No error is shown but compilations don’t (ever?) return.
I used these to build a run CmdStan in all of StanJulia/… and in JagsJulia/Jags.jl. I have removed them from StanJulia but not from Jags yet.
Both on my system and on Travis this has made a huge difference for StanJulia.
Jags might provide a reproducible case in fact. Developing Jags.jl should install Jags and ] test Jags hangs my system, currently on Julia Version 1.5.0-DEV.70 (2020-01-15) on macOS Catalina.
It would be of great help if you could confirm my suspicion. Luckily the work around is easy, using cmd interpolations instead to *.
And yes, it did come back again in the end, after about 30 mins. The tests then run until it misses Random and sits quiet for a really long time. The second pause is ok, that’s my error, must have started between Julia 1.2 and 1.3.
Just now I did rebuild Julia and was able to reproduce the ‘issue’ (very long pre-compile time). After my next build of Julia dev I will try without above constructs in master.
i will put my two cents and bet that it is the language server of the VSCode Plugin. it takes a lot of time to index the packages (variable, but over half an hour), and when its doing that, it takes a lot of resources.
I do have VS Code on my system but have not used it for several months. I use Sublime Text.
My next step is to work for a few days just on J1.3.1 two see if that reduces these very long (re-)compiles from admittedly dev-ed, but unchanged packages.
Not sure at all if my interpretation of the Open files and ports is correct, but when Julia appears to hang very often the last file open points to the repl_history.jl. Not in the cases where it came back after 10 or 15 minutes though.