# Killed julia process with threads

**URL:** <https://discourse.julialang.org/t/killed-julia-process-with-threads/35508>\
**Category:** General Usage\
**Tags:** question\
**Created:** [March 4, 2020, 8:48am UTC](https://discourse.julialang.org/t/killed-julia-process-with-threads/35508 "2020-03-04T08:48:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 4, 2020, 8:48am UTC](https://discourse.julialang.org/t/killed-julia-process-with-threads/35508/1 "2020-03-04T08:48:50Z")

</div>

I am calculating slices of a multivariate function, with and without threads (here, commented out):

```julia
function calculate_slice(f, x, i, xl, xu; n = 50)
    z = range(xl, xu; length = n)
    fz = zeros(n)
    #=Threads.@threads=# for j in 1:n
        y = vcat(x[1:(i-1)], z[j], x[(i+1):end])
        fz[i] = f(y)
    end
    (i = i, xi = x[i], z = z, fz = fz)
end

```

`f` here is very CPU- and memory-intensive (about 10K LOC + dependencies, so sorry, no MWE 🙂 ).

When I use threads, the julia process ends up killed with no error message. I am using the 1.4-rc branch.

Any hints on debugging this would be appreciated. Would something like this happen if Julia ran out of memory?

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [March 4, 2020, 8:57am UTC](https://discourse.julialang.org/t/killed-julia-process-with-threads/35508/2 "2020-03-04T08:57:41Z")

</div>

Is the Out of Memory Killer (OOM) killer being triggered?  
On Linux use sudo dmesg to see if this is logged

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 4, 2020, 9:22am UTC](https://discourse.julialang.org/t/killed-julia-process-with-threads/35508/3 "2020-03-04T09:22:20Z")

</div>

Thanks, that’s what is happening:

```nohighlight
$ dmesg | tail -3
[241730.696827] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/session-c1.scope,task=julia,pid=21662,uid=1000
[241730.696877] Out of memory: Killed process 21662 (julia) total-vm:15685904kB, anon-rss:12200080kB, file-rss:0kB, shmem-rss:0kB
[241731.105188] oom_reaper: reaped process 21662 (julia), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB

```
